> On Jun 14, 2018, at 23:01 , Peter Bogdanoff via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> Charles, 
> This is from something that I’m doing where the user can use the arrow keys 
> to hilite another line or even scroll the field (my field has hundreds of 
> lines). Also as a bonus, pressing the enter or return keys on the keyboard 
> will do the same as clicking on the line.
> 
> You probably would put this into the card script.
> 
> Peter Bogdanoff

<snip>

I do a similar thing, popping up a list field with similar lines to what the 
user typed into another field, and allowing the user to arrow and select with 
return or spacebar. I use arrowKey. 

Bob S

on mouseDown
   put the clickLine into theClickedLine
   put  value(theClickedLine) into theSalesPerson
   put theSalesPerson into field "fldSalesPerson"
   hide me
end mouseDown

on selectionChanged
   put the clickLine into theClickedLine
   put  value(theClickedLine) into theSalesPerson
   put theSalesPerson into field "fldSalesPerson"
   hide me
end selectionChanged

on openField
   put the hilitedLine of me into theHilitedLine
   put line theHilitedLine of the text of me into theSalesPerson
   put theSalesPerson into field "fldSalesPerson"
end openField

on returnInField
   put the hilitedLine of me into theHilitedLine
   put line theHilitedLine of the text of me into theSalesPerson
   put theSalesPerson into field "fldSalesPerson"
   hide me
end returnInField

on rawKeyDown pKey
   if pKey is 32 or pKey is 65289 then
      send returnInField to me in 0 seconds
   end if
   pass rawKeyDown
end rawKeyDown

on arrowKey pDirection
   switch pDirection
      case "up"
         if the hilitedLine of me >1 then set the hilitedLine of me to the 
hilitedLine of me -1
         break
      case "down"
         if the hilitedLine of me < the number of lines of the text of me then \
               set the hilitedLine of me to the hilitedLine of me +1
         break
   end switch
   
   put the hilitedLine of me into theHilitedLine
   put line theHilitedLine of the text of me into theSalesPerson
   put theSalesPerson into field "fldSalesPerson"
   pass arrowKey
end arrowKey

on exitField
   hide me
end exitField


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

Reply via email to