Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsFocus jump when setting text in focusLost event
https://www.eclipse.org/forums/index.php/mv/msg/36915/119934/#msg_119934
with RAP 1.2M4, in IE7, Chrome, and Safari (Windows) I've a problem with
Text widgets.
The Texts have a FocusListener that in focusLost event sets the text to
upper case.
When I type some chars and exit the first Text, even with tab key or
mouse, the text exactly turns to upper case, but the focus return to the
first Text.
Also, if I press tab another time the focus goes to the last Text,
skipping the second Text.
In Firefox and Opera the focus behaves exactly as in SWT.
I haven't found similar bugs...
Thanks!
Here is the snippet:
public class RapTest implements IEntryPoint {
private Display d;
private Shell s;
@Override
public int createUI() {
d = new Display();
s = new Shell(d);
s.setBounds(0, 0, 800, 600);
Text t1 = new Text(s, SWT.BORDER);
Text t2 = new Text(s, SWT.BORDER);
Text t3 = new Text(s, SWT.BORDER);
FocusAdapter fa = new FocusAdapter() {
@Override
public void focusLost(FocusEvent event) {
Text t = (Text) event.widget;
String s = t.getText();
if( s != null && s.length() > 0 )
t.setText( s.toUpperCase() );
}
};
while( !s.isDisposed() )
if( !d.readAndDispatch() )
d.sleep();
d.dispose();
return 0;
}
}]]>Enrico Zanaga2009-01-28T16:13:58-00:00Re: Focus jump when setting text in focusLost event
https://www.eclipse.org/forums/index.php/mv/msg/36915/120001/#msg_120001
would you mind opening a bug in our bugzilla?
See http://wiki.eclipse.org/RAP_Bug_Reporting_Howto
Thanks,
Ralf
Enrico Zanaga wrote:
> with RAP 1.2M4, in IE7, Chrome, and Safari (Windows) I've a problem with
> Text widgets.
> The Texts have a FocusListener that in focusLost event sets the text to
> upper case.
> When I type some chars and exit the first Text, even with tab key or
> mouse, the text exactly turns to upper case, but the focus return to the
> first Text.
> Also, if I press tab another time the focus goes to the last Text,
> skipping the second Text.
>
> In Firefox and Opera the focus behaves exactly as in SWT.
>
> I haven't found similar bugs...
>
> Thanks!
>
>
> Here is the snippet:
>
> public class RapTest implements IEntryPoint {
> private Display d;
> private Shell s;
>
> @Override
> public int createUI() {
> d = new Display();
> s = new Shell(d);
> s.setBounds(0, 0, 800, 600);
>
> Text t1 = new Text(s, SWT.BORDER);
> Text t2 = new Text(s, SWT.BORDER);
> Text t3 = new Text(s, SWT.BORDER);
>
> t1.setBounds(020, 20, 80, 20);
> t2.setBounds(120, 20, 80, 20);
> t3.setBounds(220, 20, 80, 20);
>
> FocusAdapter fa = new FocusAdapter() {
> @Override
> public void focusLost(FocusEvent event) {
> Text t = (Text) event.widget;
> String s = t.getText();
> if( s != null && s.length() > 0 )
> t.setText( s.toUpperCase() );
> }
> };
>
> t1.addFocusListener(fa);
> t2.addFocusListener(fa);
> t3.addFocusListener(fa);
>
> s.open();
>
> while( !s.isDisposed() )
> if( !d.readAndDispatch() )
> d.sleep();
> d.dispose();
> return 0;
> }
> }]]>Ralf Sternberg2009-01-29T10:41:27-00:00