Events lost focus and get focus are fired two times [message #1727020] |
Fri, 18 March 2016 10:11 |
Nicola Zanaga Messages: 56 Registered: July 2009 |
Member |
|
|
When you put a listener on a shell, events lost / get focus on text controls in the shell, are doubled:
I'm using
rap-3.0.2-SR2-20160201-1220
public static void casetestDoubleEventsRAP() {
Display display = Display.getDefault();
Shell s = new Shell();
s.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent event) {
System.out.println("shell lost focus");
}
@Override
public void focusGained(FocusEvent event) {
System.out.println("shell get focus");
}
});
Text txt1 = new Text(s, SWT.BORDER);
txt1.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent event) {
System.out.println("txt1 lost focus");
}
@Override
public void focusGained(FocusEvent event) {
System.out.println("txt1 get focus");
}
});
Text txt2 = new Text(s, SWT.BORDER);
txt2.addFocusListener(new FocusListener() {
@Override
public void focusLost(FocusEvent event) {
System.out.println("txt2 lost focus");
}
@Override
public void focusGained(FocusEvent event) {
System.out.println("txt2 get focus");
}
});
s.setLayout(new FillLayout());
s.setBounds(new Rectangle(0, 0, 600, 600));
s.open();
for( ;; ) {
if( display.isDisposed() || s.isDisposed() )
return;
if( !display.readAndDispatch() )
display.sleep();
}
}
[Updated on: Fri, 18 March 2016 10:13] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02783 seconds