Capture down or up arrow in textfield

Hi guys,

I am trying to make the down arrow shift focus to the next textfield (basically simulating a tab press) and the up arrow shift focus to the previous textfield (basically simulating a shift-tab).

I tried to add to the keypress event of the textfield like:
in textfield1:
if key = chr(5) then
textfield2.setfocus
end if

If i could get that working, i would probably try to work out a way to actually send a tab like:
if key = chr(5) then
do code to send a tab press
end if

I come from VFP and this sort of code works well. I am on a mac now, so not sure if that makes a difference also.

Cheers
Andrew

In the keydown event, check for chr(30) (down arrow) or chr(31) (up arrow), setfocus, and return true to prevent the TextField to get the key.

awesome, thanks.
Any idea how to send a tab press? rather than having to go through each textfield and manually set which field to go to next, i could just send a tab in place of the down arrow.

Cheers

[quote=162856:@Andrew Willyan]awesome, thanks.
Any idea how to send a tab press? rather than having to go through each textfield and manually set which field to go to next, i could just send a tab in place of the down arrow.
[/quote]

On Mac, you cannot send keys to the system the way some PC apps do with SendKeys. And the way tab (chr(9) manages tab stop going from one field to another is not managed from within the textfields, so replacing chr(30) by chr(9) on Keydown will simply do nothing.

Using Setfocus is the right way to do what you want to do.

hmmm. shame.
Thanks.
Will do it the hard way :frowning:
lol

Use Window.FocusNext

Awesome! Thanks so much.