Toolbar Get / Lost Focus events handles different from SWT [message #1767753] |
Mon, 10 July 2017 16:12 |
Nicola Zanaga Messages: 56 Registered: July 2009 |
Member |
|
|
I found problems with focus event in toolbar.
When using toolbar with "SWT.NO_FOCUS" option I expect a mouse click on toolbar doesn't generate any lost / get event.
In the snippet below, clicking first on text box, and after on toolbar, generate a lost focus for text box and a get focus for the underlying shell.
In swt doesn't generate events.
This is similar to another question related to bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=499085
FocusListener focusListener = new FocusListener() {
@Override
public void focusLost(FocusEvent event) {
System.out.println("lost focus " + event.widget);
}
@Override
public void focusGained(FocusEvent event) {
System.out.println("get focus " + event.widget);
}
};
Shell s = new Shell();
s.addFocusListener(focusListener);
Composite c = new Composite(s, SWT.NONE);
c.setBounds(0, 0, 400, 500);
c.addFocusListener(focusListener);
Text t = new Text(c, SWT.BORDER);
t.setBounds(0, 0, 400, 400);
t.addFocusListener(focusListener);
ToolBar b = new ToolBar(c, SWT.FLAT | SWT.NO_FOCUS);
b.setBounds(0, 400, 400, 100);
ToolItem ti = new ToolItem(b, SWT.NONE);
ti.setImage(Display.getDefault().getSystemImage(SWT.ICON_INFORMATION));
b.addFocusListener(focusListener);
s.open();
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06709 seconds