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

Looks like TraverseListener is a special listener for certain keys (tabs, arrows). Thank you very much.

Kashif.

On 11/10/06, Steve Northover <Steve_Northover@xxxxxxxxxx> wrote:

Actually, http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet127.java does exactly what you want (for a button instead).



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


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




Back to the top