Keypress to value

Started by Giuseppe Chillemi on 9-Jun-2018/2:59:40-7:00
Hi, I need to get a corresponding value from a keypress of cursor up/down. How can I do it ?
view layout [ Txt "press a key" do [ print "Installing event function" evtfunc: insert-event-func [ --- if equal? event/type 'key [ print event/key ] if equal? event/type 'close [ print "Removing event function" remove-event-func :evtfunc ] RETURN event ] ] ]
R E B O L [] view layout [ h3 "Press the up or down arrow key" origin key keycode [up] [alert "You pressed the UP arrow key"] key keycode [down] [alert "You pressed the DOWN arrow key"] ]
You said "get a corresponding value from a keypress of cursor up/down". Perhaps the intent is something like this? R E B O L [] view layout [ f: field 50 "0" origin key keycode [up] [f/text: form 1 + do f/text show f] key keycode [down] [f/text: form (do f/text) - 1 show f] ]

Reply