A question about using Arrow Keys in a Listbox

Charles Szasz cszasz at mac.com
Mon Aug 1 10:12:58 EDT 2011


I am using Rev. 4.0. I have a mileage app that has two list fields: From and To

In the first list field (From) I have the following script:

on mouseDown
     global globalFrom
     put word 2 of the clickline into globalFrom
end mouseDown


In the second list field (To), I have the following script:

on mouseDown
     global globalFrom
     global globalTo
     
     put word 2 of the clickline into globalTo
     
     if globalFrom > "" and globalTo >""
     then put globalFrom,GlobalTo into theMatch
     else
          answer information "Please make a selection from both list boxes"
     end if
      
     put the dist["travel"] of field "data" into theMatch2
     repeat for each line theMatch2 in the dist["travel"] of field "data"
          if item 1 to 2 of theMatch = item 1 to 2 of theMatch2 then
               put item 3 theMatch2 into field "results"
               exit repeat
          end if
     end repeat
      
end mouseDown

The script works great when the user clicks on a line in the first field and then clicks in a line from the second field, which displays the mileage between two points in a field "results". I would like to implement in the second list where the user could simply use the arrow keys to go up or down and display the mileage for difference locations in the second list.  How can I do that?


Charles Szasz
cszasz at mac.com







More information about the use-livecode mailing list