A question about using Arrow Keys in a Listbox

dunbarx at aol.com dunbarx at aol.com
Mon Aug 1 14:44:31 EDT 2011


I see that there are other fields involved, but in any case, check out the "arrowKey" message in the dictionary. It can be used in place of your mouseDown message. You can determine the selectedLine and then use the arrowKey parameters to know which way the user went.


Craig Newman


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







-----Original Message-----
From: Charles Szasz <cszasz at mac.com>
To: use-livecode <use-livecode at lists.runrev.com>
Sent: Mon, Aug 1, 2011 6:15 am
Subject: A question about using Arrow Keys in a Listbox


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




_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list