Click to See Complete Forum and Search --> : Impersonating Keystrokes


rvlc05
02-25-2003, 07:43 AM
I would like to send a Tab to the window when the user hits the Enter key.

How do I go about doing this???

Thank,

Paul

Nicodemas
02-25-2003, 08:29 AM
do you want to actually tab over, as if someone had hit the tab button, or to set the focus on the next object in the TABINDEX.?

khaki
02-25-2003, 08:33 AM
Hi Paul...

Are you just trying to move the user through a form, or are you trying to do something else? (I'm usually wary about altering a users expectations of thier own keyboard/mouse).

If you explain how you are looking to apply this, maybe there are different ways to accomplish it.

let us/me know...
k

rvlc05
02-25-2003, 08:48 AM
My goal here is to allow my users to do as much work from the keypad as possible.

So, using the enter key, I need move to the next control in the tabindex unless the control is a submit button, in which case I'll submit the form.

Thanks for your quick response.

Paul

khaki
02-25-2003, 09:49 AM
OK, here's my quick response:
Assign an onkeypress event to the control with the current focus.

if (window.event.keycode=='###')
* code to change the focus

Why is this a really "quick response"?
Because I don't know the keycode # for the return key :rolleyes: (but that should be easy enough for you to figure out, hopefully).
Helpful? (...wrong? :eek: )
k

pyro
02-25-2003, 10:30 AM
The keycode for enter is 13. :)

khaki
02-25-2003, 10:42 AM
Once again my hero comes to my rescue (and then disappears to his secret Pyro-cave).
Thanks Pyro.

pyro
02-25-2003, 10:45 AM
Originally posted by khaki
(and then disappears to his secret Pyro-cave).lol...Actually, it's time to go scan some pictures for a client... I've got to do over 400 of them...

khaki
02-25-2003, 10:50 AM
I liked my version better, Pyro (c'mon, your ruining all of the mystery that I'm surrounding you with!).

Oh, well... better quit here before the forum police nab me for gabbin'

Good luck with your files (files of criminal masterminds, no doubt. lol)
k