Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Tabbing not working on Custom widget when key events are listened to
Tabbing not working on Custom widget when key events are listened to [message #455631] Wed, 18 May 2005 16:34 Go to next message
Sean Kirby is currently offline Sean KirbyFriend
Messages: 14
Registered: July 2009
Junior Member
Hello,

I'm having a rather bizarre problem using SWT 3.0.1 on win32. The
problem is that i have a custom widget that is a composite of several
other swt widgets and tabbing into the custom widget seems to work fine
until i add a KeyListener to the custom widget. At this point tabbing
from a regular widget to the custom widget goes into a sort of 'limbo'
and i have to hit tab again for the focus to go into the first widget of
my custom widget. So what i'm seeing, is that 2 tabs are required for
the focus to show up in the first widget of my custom widget.

Here is some sample code illustrating my problem:

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class TestWidget extends Composite
{

public static void main(String [] args)
{
TestWidget.runUI();
}

public static void runUI()
{
Display display = Display.getDefault();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout(SWT.VERTICAL));

new Text(shell, SWT.BORDER);

TestWidget widget = new TestWidget(shell, SWT.NONE);
widget.addKeyListener(new KeyListener()
{
public void keyReleased(KeyEvent e)
{

}

public void keyPressed(KeyEvent e)
{
System.out.println("Outer key down: " + e);
}
});

shell.open();
while (shell != null && !shell.isDisposed())
{
try
{
if (!display.readAndDispatch())
display.sleep();
}
catch (Throwable e)
{
System.err.println("The following stack trace should not have
occurred");
e.printStackTrace();
}
}
display.update();
shell.dispose();
}

public TestWidget(Composite parent, int style)
{
super(parent, style);

createContents(this);
handleTraversal();
}

private void handleTraversal()
{
addListener(SWT.Traverse, new Listener()
{
public void handleEvent(Event e)
{
System.out.println("Traverse: " + e + " detail: " + e.detail + "
doit: " + e.doit);
switch (e.detail)
{
/* Do tab group traversal */
case SWT.TRAVERSE_ESCAPE :
case SWT.TRAVERSE_RETURN :
case SWT.TRAVERSE_TAB_NEXT :
case SWT.TRAVERSE_TAB_PREVIOUS :
case SWT.TRAVERSE_PAGE_NEXT :
case SWT.TRAVERSE_PAGE_PREVIOUS :
e.doit = true;
break;
}
}
});
}


private void createContents(TestWidget parent)
{
GridLayout layout = new GridLayout(2, false);
parent.setLayout(layout);

new Label(parent, SWT.NONE).setText("one");
Text text1 = new Text(parent, SWT.BORDER);

new Label(parent, SWT.NONE).setText("two");
Text text2 = new Text(parent, SWT.BORDER);

new Label(parent, SWT.NONE).setText("three");
Text text3 = new Text(parent, SWT.BORDER);
}

}
Re: Tabbing not working on Custom widget when key events are listened to [message #455632 is a reply to message #455631] Wed, 18 May 2005 16:50 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Once you add a key listener to your custom widget, it means that your widget
is capable of accepting keyboard input and therefore keyboard focus. As a
result, in the tab order, focus is going to your custom widget but your
custom widget is not giving any visual indication that it has focus. For
example, if you add the following lines to your code below you will see what
is happening.

public TestWidget(Composite parent, int style) {
super(parent, style);

createContents(this);
handleTraversal();
addListener(SWT.FocusIn, new Listener() {
public void handleEvent(Event e) {
setBackground(getDisplay().getSystemColor(SWT.COLOR_RED));
}
});
addListener(SWT.FocusOut, new Listener() {
public void handleEvent(Event e) {
setBackground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
}
});
}

"Sean Kirby" <sskirby@alumni.uwaterloo.ca> wrote in message
news:d6fqsf$a38$1@news.eclipse.org...
> Hello,
>
> I'm having a rather bizarre problem using SWT 3.0.1 on win32. The problem
> is that i have a custom widget that is a composite of several other swt
> widgets and tabbing into the custom widget seems to work fine until i add
> a KeyListener to the custom widget. At this point tabbing from a regular
> widget to the custom widget goes into a sort of 'limbo' and i have to hit
> tab again for the focus to go into the first widget of my custom widget.
> So what i'm seeing, is that 2 tabs are required for the focus to show up
> in the first widget of my custom widget.
>
> Here is some sample code illustrating my problem:
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.events.KeyEvent;
> import org.eclipse.swt.events.KeyListener;
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.layout.GridLayout;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Event;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.widgets.Listener;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Text;
>
> public class TestWidget extends Composite
> {
>
> public static void main(String [] args)
> {
> TestWidget.runUI();
> }
>
> public static void runUI()
> {
> Display display = Display.getDefault();
> Shell shell = new Shell(display);
> shell.setLayout(new FillLayout(SWT.VERTICAL));
>
> new Text(shell, SWT.BORDER);
>
> TestWidget widget = new TestWidget(shell, SWT.NONE);
> widget.addKeyListener(new KeyListener()
> {
> public void keyReleased(KeyEvent e)
> {
>
> }
>
> public void keyPressed(KeyEvent e)
> {
> System.out.println("Outer key down: " + e);
> }
> });
>
> shell.open();
> while (shell != null && !shell.isDisposed())
> {
> try
> {
> if (!display.readAndDispatch())
> display.sleep();
> }
> catch (Throwable e)
> {
> System.err.println("The following stack trace should not have occurred");
> e.printStackTrace();
> }
> }
> display.update();
> shell.dispose();
> }
>
> public TestWidget(Composite parent, int style)
> {
> super(parent, style);
>
> createContents(this);
> handleTraversal();
> }
>
> private void handleTraversal()
> {
> addListener(SWT.Traverse, new Listener()
> {
> public void handleEvent(Event e)
> {
> System.out.println("Traverse: " + e + " detail: " + e.detail + " doit: " +
> e.doit);
> switch (e.detail)
> {
> /* Do tab group traversal */
> case SWT.TRAVERSE_ESCAPE :
> case SWT.TRAVERSE_RETURN :
> case SWT.TRAVERSE_TAB_NEXT :
> case SWT.TRAVERSE_TAB_PREVIOUS :
> case SWT.TRAVERSE_PAGE_NEXT :
> case SWT.TRAVERSE_PAGE_PREVIOUS :
> e.doit = true;
> break;
> }
> }
> });
> }
>
>
> private void createContents(TestWidget parent)
> {
> GridLayout layout = new GridLayout(2, false);
> parent.setLayout(layout);
>
> new Label(parent, SWT.NONE).setText("one");
> Text text1 = new Text(parent, SWT.BORDER);
>
> new Label(parent, SWT.NONE).setText("two");
> Text text2 = new Text(parent, SWT.BORDER);
>
> new Label(parent, SWT.NONE).setText("three");
> Text text3 = new Text(parent, SWT.BORDER);
> }
>
> }
Re: Tabbing not working on Custom widget when key events are listened to [message #455642 is a reply to message #455632] Wed, 18 May 2005 19:18 Go to previous messageGo to next message
Sean Kirby is currently offline Sean KirbyFriend
Messages: 14
Registered: July 2009
Junior Member
Thanks for the reply Veronika, that explains a lot. What i really want
to do is to have my custom widget forward the key up and down events
that happen on the internal widgets to clients listening to the custom
widget. So is there any way of telling my custom widget that it should
*not* accept keyboard focus when i install a key listener on it?

Thanks a lot,
Sean

Veronika Irvine wrote:
> Once you add a key listener to your custom widget, it means that your widget
> is capable of accepting keyboard input and therefore keyboard focus. As a
> result, in the tab order, focus is going to your custom widget but your
> custom widget is not giving any visual indication that it has focus. For
> example, if you add the following lines to your code below you will see what
> is happening.
>
> public TestWidget(Composite parent, int style) {
> super(parent, style);
>
> createContents(this);
> handleTraversal();
> addListener(SWT.FocusIn, new Listener() {
> public void handleEvent(Event e) {
> setBackground(getDisplay().getSystemColor(SWT.COLOR_RED));
> }
> });
> addListener(SWT.FocusOut, new Listener() {
> public void handleEvent(Event e) {
> setBackground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
> }
> });
> }
>
> "Sean Kirby" <sskirby@alumni.uwaterloo.ca> wrote in message
> news:d6fqsf$a38$1@news.eclipse.org...
>
>>Hello,
>>
>>I'm having a rather bizarre problem using SWT 3.0.1 on win32. The problem
>>is that i have a custom widget that is a composite of several other swt
>>widgets and tabbing into the custom widget seems to work fine until i add
>>a KeyListener to the custom widget. At this point tabbing from a regular
>>widget to the custom widget goes into a sort of 'limbo' and i have to hit
>>tab again for the focus to go into the first widget of my custom widget.
>>So what i'm seeing, is that 2 tabs are required for the focus to show up
>>in the first widget of my custom widget.
>>
>>Here is some sample code illustrating my problem:
>>
>>import org.eclipse.swt.SWT;
>>import org.eclipse.swt.events.KeyEvent;
>>import org.eclipse.swt.events.KeyListener;
>>import org.eclipse.swt.layout.FillLayout;
>>import org.eclipse.swt.layout.GridLayout;
>>import org.eclipse.swt.widgets.Composite;
>>import org.eclipse.swt.widgets.Display;
>>import org.eclipse.swt.widgets.Event;
>>import org.eclipse.swt.widgets.Label;
>>import org.eclipse.swt.widgets.Listener;
>>import org.eclipse.swt.widgets.Shell;
>>import org.eclipse.swt.widgets.Text;
>>
>>public class TestWidget extends Composite
>>{
>>
>>public static void main(String [] args)
>>{
>>TestWidget.runUI();
>>}
>>
>>public static void runUI()
>>{
>>Display display = Display.getDefault();
>>Shell shell = new Shell(display);
>>shell.setLayout(new FillLayout(SWT.VERTICAL));
>>
>>new Text(shell, SWT.BORDER);
>>
>>TestWidget widget = new TestWidget(shell, SWT.NONE);
>>widget.addKeyListener(new KeyListener()
>>{
>>public void keyReleased(KeyEvent e)
>>{
>>
>>}
>>
>>public void keyPressed(KeyEvent e)
>>{
>>System.out.println("Outer key down: " + e);
>>}
>>});
>>
>>shell.open();
>>while (shell != null && !shell.isDisposed())
>>{
>>try
>>{
>>if (!display.readAndDispatch())
>>display.sleep();
>>}
>>catch (Throwable e)
>>{
>>System.err.println("The following stack trace should not have occurred");
>>e.printStackTrace();
>>}
>>}
>>display.update();
>>shell.dispose();
>>}
>>
>>public TestWidget(Composite parent, int style)
>>{
>>super(parent, style);
>>
>>createContents(this);
>>handleTraversal();
>>}
>>
>>private void handleTraversal()
>>{
>>addListener(SWT.Traverse, new Listener()
>>{
>>public void handleEvent(Event e)
>>{
>>System.out.println("Traverse: " + e + " detail: " + e.detail + " doit: " +
>>e.doit);
>>switch (e.detail)
>>{
>>/* Do tab group traversal */
>>case SWT.TRAVERSE_ESCAPE :
>>case SWT.TRAVERSE_RETURN :
>>case SWT.TRAVERSE_TAB_NEXT :
>>case SWT.TRAVERSE_TAB_PREVIOUS :
>>case SWT.TRAVERSE_PAGE_NEXT :
>>case SWT.TRAVERSE_PAGE_PREVIOUS :
>>e.doit = true;
>>break;
>>}
>>}
>>});
>>}
>>
>>
>>private void createContents(TestWidget parent)
>>{
>>GridLayout layout = new GridLayout(2, false);
>>parent.setLayout(layout);
>>
>>new Label(parent, SWT.NONE).setText("one");
>>Text text1 = new Text(parent, SWT.BORDER);
>>
>>new Label(parent, SWT.NONE).setText("two");
>>Text text2 = new Text(parent, SWT.BORDER);
>>
>>new Label(parent, SWT.NONE).setText("three");
>>Text text3 = new Text(parent, SWT.BORDER);
>>}
>>
>>}
>
>
>
Re: Tabbing not working on Custom widget when key events are listened to [message #455666 is a reply to message #455642] Thu, 19 May 2005 14:05 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Add the following listener to your custom control and it will move the focus
to the right place:

addListener(SWT.FocusIn, new Listener() {
public void handleEvent(Event e) {
setFocus();
}
});



"Sean Kirby" <sskirby@alumni.uwaterloo.ca> wrote in message
news:d6g4ge$mon$1@news.eclipse.org...
> Thanks for the reply Veronika, that explains a lot. What i really want to
> do is to have my custom widget forward the key up and down events that
> happen on the internal widgets to clients listening to the custom widget.
> So is there any way of telling my custom widget that it should *not*
> accept keyboard focus when i install a key listener on it?
>
> Thanks a lot,
> Sean
>
> Veronika Irvine wrote:
>> Once you add a key listener to your custom widget, it means that your
>> widget is capable of accepting keyboard input and therefore keyboard
>> focus. As a result, in the tab order, focus is going to your custom
>> widget but your custom widget is not giving any visual indication that it
>> has focus. For example, if you add the following lines to your code
>> below you will see what is happening.
>>
>> public TestWidget(Composite parent, int style) {
>> super(parent, style);
>>
>> createContents(this);
>> handleTraversal();
>> addListener(SWT.FocusIn, new Listener() {
>> public void handleEvent(Event e) {
>> setBackground(getDisplay().getSystemColor(SWT.COLOR_RED));
>> }
>> });
>> addListener(SWT.FocusOut, new Listener() {
>> public void handleEvent(Event e) {
>> setBackground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
>> }
>> });
>> }
>>
>> "Sean Kirby" <sskirby@alumni.uwaterloo.ca> wrote in message
>> news:d6fqsf$a38$1@news.eclipse.org...
>>
>>>Hello,
>>>
>>>I'm having a rather bizarre problem using SWT 3.0.1 on win32. The
>>>problem is that i have a custom widget that is a composite of several
>>>other swt widgets and tabbing into the custom widget seems to work fine
>>>until i add a KeyListener to the custom widget. At this point tabbing
>>>from a regular widget to the custom widget goes into a sort of 'limbo'
>>>and i have to hit tab again for the focus to go into the first widget of
>>>my custom widget. So what i'm seeing, is that 2 tabs are required for the
>>>focus to show up in the first widget of my custom widget.
>>>
>>>Here is some sample code illustrating my problem:
>>>
>>>import org.eclipse.swt.SWT;
>>>import org.eclipse.swt.events.KeyEvent;
>>>import org.eclipse.swt.events.KeyListener;
>>>import org.eclipse.swt.layout.FillLayout;
>>>import org.eclipse.swt.layout.GridLayout;
>>>import org.eclipse.swt.widgets.Composite;
>>>import org.eclipse.swt.widgets.Display;
>>>import org.eclipse.swt.widgets.Event;
>>>import org.eclipse.swt.widgets.Label;
>>>import org.eclipse.swt.widgets.Listener;
>>>import org.eclipse.swt.widgets.Shell;
>>>import org.eclipse.swt.widgets.Text;
>>>
>>>public class TestWidget extends Composite
>>>{
>>>
>>>public static void main(String [] args)
>>>{
>>>TestWidget.runUI();
>>>}
>>>
>>>public static void runUI()
>>>{
>>>Display display = Display.getDefault();
>>>Shell shell = new Shell(display);
>>>shell.setLayout(new FillLayout(SWT.VERTICAL));
>>>
>>>new Text(shell, SWT.BORDER);
>>>
>>>TestWidget widget = new TestWidget(shell, SWT.NONE);
>>>widget.addKeyListener(new KeyListener()
>>>{
>>>public void keyReleased(KeyEvent e)
>>>{
>>>
>>>}
>>>
>>>public void keyPressed(KeyEvent e)
>>>{
>>>System.out.println("Outer key down: " + e);
>>>}
>>>});
>>>
>>>shell.open();
>>>while (shell != null && !shell.isDisposed())
>>>{
>>>try
>>>{
>>>if (!display.readAndDispatch())
>>>display.sleep();
>>>}
>>>catch (Throwable e)
>>>{
>>>System.err.println("The following stack trace should not have occurred");
>>>e.printStackTrace();
>>>}
>>>}
>>>display.update();
>>>shell.dispose();
>>>}
>>>
>>>public TestWidget(Composite parent, int style)
>>>{
>>>super(parent, style);
>>>
>>>createContents(this);
>>>handleTraversal();
>>>}
>>>
>>>private void handleTraversal()
>>>{
>>>addListener(SWT.Traverse, new Listener()
>>>{
>>>public void handleEvent(Event e)
>>>{
>>>System.out.println("Traverse: " + e + " detail: " + e.detail + " doit: "
>>>+ e.doit);
>>>switch (e.detail)
>>>{
>>>/* Do tab group traversal */
>>>case SWT.TRAVERSE_ESCAPE :
>>>case SWT.TRAVERSE_RETURN :
>>>case SWT.TRAVERSE_TAB_NEXT :
>>>case SWT.TRAVERSE_TAB_PREVIOUS :
>>>case SWT.TRAVERSE_PAGE_NEXT :
>>>case SWT.TRAVERSE_PAGE_PREVIOUS :
>>>e.doit = true;
>>>break;
>>>}
>>>}
>>>});
>>>}
>>>
>>>
>>>private void createContents(TestWidget parent)
>>>{
>>>GridLayout layout = new GridLayout(2, false);
>>>parent.setLayout(layout);
>>>
>>>new Label(parent, SWT.NONE).setText("one");
>>>Text text1 = new Text(parent, SWT.BORDER);
>>>
>>>new Label(parent, SWT.NONE).setText("two");
>>>Text text2 = new Text(parent, SWT.BORDER);
>>>
>>>new Label(parent, SWT.NONE).setText("three");
>>>Text text3 = new Text(parent, SWT.BORDER);
>>>}
>>>
>>>}
>>
>>
Re: Tabbing not working on Custom widget when key events are listened to [message #455706 is a reply to message #455666] Thu, 19 May 2005 19:55 Go to previous message
Sean Kirby is currently offline Sean KirbyFriend
Messages: 14
Registered: July 2009
Junior Member
Interesting. I considered doing this, but i thought that it would break
the reverse tab behaviour by not allowing the user to <shift-tab> out of
the widget. Strangely enough, this doesn't happen!

Thanks alot for the help, Veronika. It is much appreciated.

Sean

Veronika Irvine wrote:
> Add the following listener to your custom control and it will move the focus
> to the right place:
>
> addListener(SWT.FocusIn, new Listener() {
> public void handleEvent(Event e) {
> setFocus();
> }
> });
>
>
>
> "Sean Kirby" <sskirby@alumni.uwaterloo.ca> wrote in message
> news:d6g4ge$mon$1@news.eclipse.org...
>
>>Thanks for the reply Veronika, that explains a lot. What i really want to
>>do is to have my custom widget forward the key up and down events that
>>happen on the internal widgets to clients listening to the custom widget.
>>So is there any way of telling my custom widget that it should *not*
>>accept keyboard focus when i install a key listener on it?
>>
>>Thanks a lot,
>>Sean
>>
>>Veronika Irvine wrote:
>>
>>>Once you add a key listener to your custom widget, it means that your
>>>widget is capable of accepting keyboard input and therefore keyboard
>>>focus. As a result, in the tab order, focus is going to your custom
>>>widget but your custom widget is not giving any visual indication that it
>>>has focus. For example, if you add the following lines to your code
>>>below you will see what is happening.
>>>
>>>public TestWidget(Composite parent, int style) {
>>> super(parent, style);
>>>
>>> createContents(this);
>>> handleTraversal();
>>> addListener(SWT.FocusIn, new Listener() {
>>> public void handleEvent(Event e) {
>>> setBackground(getDisplay().getSystemColor(SWT.COLOR_RED));
>>> }
>>> });
>>> addListener(SWT.FocusOut, new Listener() {
>>> public void handleEvent(Event e) {
>>> setBackground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
>>> }
>>> });
>>> }
>>>
>>>"Sean Kirby" <sskirby@alumni.uwaterloo.ca> wrote in message
>>>news:d6fqsf$a38$1@news.eclipse.org...
>>>
>>>
>>>>Hello,
>>>>
>>>>I'm having a rather bizarre problem using SWT 3.0.1 on win32. The
>>>>problem is that i have a custom widget that is a composite of several
>>>>other swt widgets and tabbing into the custom widget seems to work fine
>>>>until i add a KeyListener to the custom widget. At this point tabbing
>>>
>>>>from a regular widget to the custom widget goes into a sort of 'limbo'
>>>
>>>>and i have to hit tab again for the focus to go into the first widget of
>>>>my custom widget. So what i'm seeing, is that 2 tabs are required for the
>>>>focus to show up in the first widget of my custom widget.
>>>>
>>>>Here is some sample code illustrating my problem:
>>>>
>>>>import org.eclipse.swt.SWT;
>>>>import org.eclipse.swt.events.KeyEvent;
>>>>import org.eclipse.swt.events.KeyListener;
>>>>import org.eclipse.swt.layout.FillLayout;
>>>>import org.eclipse.swt.layout.GridLayout;
>>>>import org.eclipse.swt.widgets.Composite;
>>>>import org.eclipse.swt.widgets.Display;
>>>>import org.eclipse.swt.widgets.Event;
>>>>import org.eclipse.swt.widgets.Label;
>>>>import org.eclipse.swt.widgets.Listener;
>>>>import org.eclipse.swt.widgets.Shell;
>>>>import org.eclipse.swt.widgets.Text;
>>>>
>>>>public class TestWidget extends Composite
>>>>{
>>>>
>>>>public static void main(String [] args)
>>>>{
>>>>TestWidget.runUI();
>>>>}
>>>>
>>>>public static void runUI()
>>>>{
>>>>Display display = Display.getDefault();
>>>>Shell shell = new Shell(display);
>>>>shell.setLayout(new FillLayout(SWT.VERTICAL));
>>>>
>>>>new Text(shell, SWT.BORDER);
>>>>
>>>>TestWidget widget = new TestWidget(shell, SWT.NONE);
>>>>widget.addKeyListener(new KeyListener()
>>>>{
>>>>public void keyReleased(KeyEvent e)
>>>>{
>>>>
>>>>}
>>>>
>>>>public void keyPressed(KeyEvent e)
>>>>{
>>>>System.out.println("Outer key down: " + e);
>>>>}
>>>>});
>>>>
>>>>shell.open();
>>>>while (shell != null && !shell.isDisposed())
>>>>{
>>>>try
>>>>{
>>>>if (!display.readAndDispatch())
>>>>display.sleep();
>>>>}
>>>>catch (Throwable e)
>>>>{
>>>>System.err.println("The following stack trace should not have occurred");
>>>>e.printStackTrace();
>>>>}
>>>>}
>>>>display.update();
>>>>shell.dispose();
>>>>}
>>>>
>>>>public TestWidget(Composite parent, int style)
>>>>{
>>>>super(parent, style);
>>>>
>>>>createContents(this);
>>>>handleTraversal();
>>>>}
>>>>
>>>>private void handleTraversal()
>>>>{
>>>>addListener(SWT.Traverse, new Listener()
>>>>{
>>>>public void handleEvent(Event e)
>>>>{
>>>>System.out.println("Traverse: " + e + " detail: " + e.detail + " doit: "
>>>>+ e.doit);
>>>>switch (e.detail)
>>>>{
>>>>/* Do tab group traversal */
>>>>case SWT.TRAVERSE_ESCAPE :
>>>>case SWT.TRAVERSE_RETURN :
>>>>case SWT.TRAVERSE_TAB_NEXT :
>>>>case SWT.TRAVERSE_TAB_PREVIOUS :
>>>>case SWT.TRAVERSE_PAGE_NEXT :
>>>>case SWT.TRAVERSE_PAGE_PREVIOUS :
>>>>e.doit = true;
>>>>break;
>>>>}
>>>>}
>>>>});
>>>>}
>>>>
>>>>
>>>>private void createContents(TestWidget parent)
>>>>{
>>>>GridLayout layout = new GridLayout(2, false);
>>>>parent.setLayout(layout);
>>>>
>>>>new Label(parent, SWT.NONE).setText("one");
>>>>Text text1 = new Text(parent, SWT.BORDER);
>>>>
>>>>new Label(parent, SWT.NONE).setText("two");
>>>>Text text2 = new Text(parent, SWT.BORDER);
>>>>
>>>>new Label(parent, SWT.NONE).setText("three");
>>>>Text text3 = new Text(parent, SWT.BORDER);
>>>>}
>>>>
>>>>}
>>>
>>>
>
Previous Topic:Another SWT_AWT bridge problems
Next Topic:Problems with swt Table
Goto Forum:
  


Current Time: Thu Apr 25 19:57:36 GMT 2024

Powered by FUDForum. Page generated in 0.03574 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top