Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Getting function keys to identify/bind to a field.

 [1/4] from: mike:yaunish:shaw:ca at: 12-Dec-2005 21:07


I would like to be able to press the "F4" key to prompt for a field. Using this code it doesn't work as I would have imagined. view layout [ f1: field keycode 'F4 [ print "field #1" ] f2: field keycode 'F4 [ print "field #2" ] ] field #1 is always grabbing the keycode action. Any good ideas to work around this?

 [2/4] from: antonr:lexicon at: 13-Dec-2005 17:32


What do you mean exactly, "to prompt for a field" ? What should happen when F4 is pressed ? The reason the code below doesn't work is that the window key handler just scans for the first face whose keycode matches the key pressed. Anton.

 [3/4] from: greggirwin::mindspring::com at: 13-Dec-2005 10:33


Hi Mike, MY> I would like to be able to press the "F4" key to prompt for a field. MY> Using this code it doesn't work as I would have imagined. If I understand you, the goal is to have a hot-key that can pop up a prompt for any field. If so, you need to do it a different way. e.g. view layout [key keycode 'F4 [print "Hello from F4"]] The catch is that the general key handler doesn't know which face has focus, so you need to track or dispatch on that yourself. view layout [ f-1: field "I'm #1!" f-2: field "I'm #2" key keycode 'F4 [ switch system/view/focal-face reduce [ f-1 [print "field 1 has focus"] f-2 [print "field 2 has focus"] ] ] ] If you just set a custom word for the face and access that for your prompt info, just keep in mind that system/view/focal-face will be NONE if no face has focus. -- Gregg

 [4/4] from: mike::yaunish::shaw::ca at: 14-Dec-2005 7:27


Thanks Gregg, This is exaclty what I was looking for. I am already custom naming each field so I should be able to use their names to track who has the focus. Mike