select previous and next clickline

Sarah Reichelt sarahr at genesearch.com.au
Mon Jul 11 23:14:42 EDT 2005


> What command do you use to select the previous and next clickline  
> in the
> scrolling list field.  Thank you

Instead of tracking the clickLine in a global, you might do better to  
have your button get the hilitedLines of the list field. If you allow  
multiple selections, this will be a comma-delimited list of line  
numbers. If you only allow a single line to be selected at a time,  
this will be a single line number.

As well as using this line number to play the current track, you can  
also use it to move up & down the list. Here is an example script for  
a "Previous" button:

on mouseUp
   put the hilitedLine of fld "List" into tLineNum
   if tLineNum > 1 then
     set the hilitedLine of fld "List" to tLineNum - 1
     -- do whatever you want to do when the previous line is selected
   end if
end mouseUp

This assumes you only allow a single selection at a time.
The "Next" script will be much the same, except it needs to check for  
trying to select more lines than the field holds.

Sarah




More information about the use-livecode mailing list