Scrolling flds

simplsol at aol.com simplsol at aol.com
Tue Apr 5 16:44:46 CDT 2005


Here is an alternative script for scrolling a list field based on a 
click in an alpha field:

 on mouseDown
 --list must be sorted for alphas to make sense:
 if the hilite of btn "Sort the Card List" is false
 then send "mouseUp" to btn "Sort the Card List"
 get the value of the clickLine
 if it is empty
 then
 set the scroll of fld "Card List" to "0"
 exit mouseDown
 end if
 if it is "..."
 then
 ask "Find this character in the card list:" with "A"
 if the result is "Cancel" then exit mouseDown
 end if
 put fld "Card List" into temp
 repeat with i = 1 to the number of lines of temp
 if char 1 of line i of temp is it
 then
  set the scroll of fld "Card List" to ((i -1) * 12)--lineHeight is 12 
pixels
 exit mouseDown
 end if
 end repeat
 -- if there was no matching alpha then beep
 beep
 end mouseDown

 I have used this for a couple years now and it works well for me.
  Note: I have "..." (three dots/periods) at the top of the list which 
will bring up a dialog asking the user for special letters/characters 
which are not part of the alpha list (like umlauts, tildas, etc.).

 Paul Looney

 -----Original Message-----
 From: Eric Chatonet <eric.chatonet at sosmartsoftware.com>
 To: How to use Revolution <use-revolution at lists.runrev.com>
 Sent: Tue, 5 Apr 2005 23:15:09 +0200
 Subject: Re: Scrolling flds

 Bonsoir Yves, 
  
  LineOffset returns the number of lines between the beginning of a 
value and an occurrence of a specified string. 
  So, LineOffset does not take care of numbers or alpha chars and 
*stupidly counts the lines*. That's all :-) 
 So the code Klaus provided *should* work in all cases. 
 Your problem (I can't figure it) is elsewhere... 
 FixedLineHeight set to false? 
 Does not help to much :-( 
  
 Le 5 avr. 05, à 22:31, Yves COPPE a écrit : 
  
 > I have a fld with an alphabetical list 
  > I have a script to automatically scroll the fld at the beginning of 
a > clicked letter : tKey 
 > (thank you Klaus) 
 > 
 > put lineOffset(return & tKey, fld "body") into lo 
  > set the scroll of field "body" to (lo * the effective textHeight of 
> field "body") 
 > 
 > now, I have a problem : 
  > the list fld begins with a variable number of lines which are 
numbers > and then begins the alphabetical list 
  > so, to set the scroll of field "body", I have to add some variable > 
number to (lo * the effective textHeight of field "body") 
 > I cannot find out how I have to calculate this correction 
 > 
 > i've tried : 
 > 
 > put lineOffset(return & "a", fld "body") into tcorrection 
  > set the scroll of field "body" to (lo * the effective textHeight of 
> field "body")+ tcorrection 
 > 
  > it's good at the beginnning of the list fld but after some lines, 
it's > not correct anymore 
 > where is the error ? 
  
 Amicalement, 
  
 Eric Chatonet. 
 ---------------------------------------------------------------- 
 So Smart Software 
  
 For institutions, companies and associations 
 Built-to-order applications: management, multimedia, internet, etc. 
 Windows, Mac OS and Linux... With the French touch 
 ---------------------------------------------------------------- 
 Web site http://www.sosmartsoftware.com/ 
 Email eric.chatonet AT sosmartsoftware.com/ 
 Phone 33 (0)1 43 31 77 62 
 Mobile 33 (0)6 20 74 50 86 
 ---------------------------------------------------------------- 
  
 _______________________________________________ 
 use-revolution mailing list 
 use-revolution at lists.runrev.com 
 http://lists.runrev.com/mailman/listinfo/use-revolution 

  


More information about the use-livecode mailing list