|
|
|
Re: Who is eating my TAB key event? [message #110481 is a reply to message #110428] |
Sat, 03 January 2004 05:58 |
Eclipse User |
|
|
|
Originally posted by: none.us.ibm.com
The TAB key does not generate a key pressed if it results in focus
traversal. You need to prevent the focus traversal, in which case you will
get the TAB event. There is probably an SWT snippet showing how to do this.
See TraverseListener. You need to look for specific traversal events, and
set the doit = false.
"Alex Cozzi" <cozzi@almaden.ibm.com> wrote in message
news:bt4mnq$qdp$1@eclipse.org...
> I am trying to detect when the user presses the TAB key by extending
> org.eclipse.jface.viewers.TextCellEditor. But somewhere in the keyevent
> handling chain the tab key gets eaten and my editor does not see it.
> I am writing a GEF application, and this code is used in the same way as
> the code that changes the labels's text in the logic editor example.
>
>
> protected void keyReleaseOccured(KeyEvent keyEvent) {
> System.out.println("keyEvent: " + keyEvent);
> ctrlReturn = false;
> tab = false;
> shiftTab = false;
> if (keyEvent.character == '\u001b') { // Escape
> // character
> fireCancelEditor();
> } else if (keyEvent.character == '\r') { // Return key
> if ((keyEvent.stateMask & SWT.CTRL) != 0) {
> //System.out.println("CTRL RETURN pressed");
> ctrlReturn = true;
> }
> fireApplyEditorValue();
> deactivate();
> } else if (keyEvent.character == '\t') { // Tab key
> System.out.println("TAB pressed");
> tab = true;
>
> }
> }
|
|
|
|
Powered by
FUDForum. Page generated in 0.03202 seconds