Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Capturing TAB key in Text Widget


See http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet241.java

Change the doit from true to false and you will see the tab key in the text control.  Note that overriding tab might make your users mad when they expect it to traverse to the next control.



kash.riaz@xxxxxxxxx
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

11/10/2006 09:39 AM

Please respond to
"Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>

To
platform-swt-dev@xxxxxxxxxxx
cc
Subject
[platform-swt-dev] Capturing TAB key in Text Widget





Hello,

I have a Text widget with a KeyListener attached to it. I want to
listen for TAB events, but cannot capture them.

This is the snippet of code:
======
   myTextWidget.addKeyListener(new KeyListener(){

   public void keyPressed(KeyEvent e) {

       System.out.println("Key Pressed");
       if (e.keycode == SWT.TAB)
       {
           System.out.println("Detected TAB key");
       }
   }

   public void keyReleased(KeyEvent e) {

       System.out.println("Key Released");
   }}
   );

=======

I get output for every key that I press on a standard keyboard except
for the tab key, which forces the focus to the next widget on the
display. It seems like a special system event which cannot be
bypassed. I need to capture the tab key so I can force focus on
another widget - overriding the default tab sequence.

Does anyone know how I can achieve this?

Any help is much appreciated.

Kashif.
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top