These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

keystroke events

Leigh
Registered: Dec 10 2006
Posts: 2

Hi Thom,
 
I am looking for a solution/clue to being able run a setfocus routine when the backspace keystroke is hit.
 
I have set up some single char textboxes that setfocus on the next box in sequence when a char is entered but I want to be able to correct mistakes in the most natural way eg. when the backspace is used and I can’t seem to identify the \b keystroke event to trigger my code. Similarly, I want to identify when TAB is used so I can set focus on the next section of text boxes. I can’t pick up on the \t keystroke either.
 
Your help would be greatly appreciated.
 
Regards
 
Leigh

thomp
Expert
Registered: Feb 15 2006
Posts: 4411
This is very difficult. The text field captures both backspaces and tabs, however, event.change does not contain any characters, so there is not character code to look at. For backspace you can look at the text select properties of the event object. They'll tell you how the value has been modified. Unfortunately the backspace is only reported when there is text already in the text field, so this may not help. The tab is something altogether different. It cause the focus to change wich causes a keystroke event. But this doesn't help you because you don't know what caused the change in focus. Could have been a mouse click.

Adobe didn't make this kind of thing easy. In fact I think your SOL.

Cheers,
Thom Parker
WindJack Solutions
[url=http://www.windjack.com]www.windjack.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://partners.adobe.com/public/developer/en/acrobat/sdk/
pdf/javascript/AcroJS.pdf]Acrobat JavaScript Reference[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script