ccsrvc
18th October 2002, 17:00
has anyone had success responding to a single keystroke.

say i have a field that intended to hold only a single digit (0 thru 9). I want to process the key stroke immediately without the user having to tab or press enter. i am exploring the use of data.input and keyin functions but would like some feedback from programmmers who may have already done this.

Thank You

NPRao
18th October 2002, 19:20
Try to use the predefined variable - in.ret

Refer to the posting -

http://www.baanboard.com/baanboard/showthread.php?s=&threadid=7041&highlight=in.ret

ccsrvc
18th October 2002, 21:25
Thanks for your reply.

the "on.input" section of the form field contains the following code:
string results(50)
results = sprintf("Key: %d", in.ret)
message(results)

I expect to see this message pop when I press a key in this field but I do not. The message only pops up when I press the tab key afterwards.

Thanks for your help

mark_h
18th October 2002, 22:05
In the below example I set the attr.nowait to CTRL-J. Then in this field when I hit control-j it jumps to the check input. There you can check the key value.


field.main.f:
before.input:
attr.nowait$ = chr$(10)


check.input:
string results(50)
results = sprintf$("Key: %d", in.ret)
message(results)
if in.ret=10 then
....code...
endif


Good Luck!

Mark