Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Problem with focuslost(Problem with focuslost)
Problem with focuslost [message #634395] Thu, 21 October 2010 14:37 Go to next message
No real name is currently offline No real nameFriend
Messages: 1
Registered: October 2010
Junior Member
Hi everybody, i'm having trouble with this code:

import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;

public class wdw
{
public static void main(String[] args) {
Display dis = new Display();
final Shell s = new Shell(dis);
s.setLayout(new GridLayout(1, false));
s.setSize(300, 200);
Text t1=new Text(s, SWT.BORDER);
t1.setTextLimit(20);

Text t2=new Text(s, SWT.BORDER);
t2.setTextLimit(20);

final FocusListener listener = new FocusListener() {
public void focusGained(FocusEvent event) { }
public void focusLost(FocusEvent event) {
MessageBox msgBox = new MessageBox(s, SWT.ICON_INFORMATION|SWT.OK);
msgBox.setMessage("focus lost");
msgBox.setText("Focus lost");
msgBox.open();
}
};

t1.addFocusListener(listener);

s.open();
while (!s.isDisposed()) {
if (!dis.readAndDispatch())
dis.sleep();
}
dis.dispose();
}

after focuslost event in t1 when I click on OK button in message box the control return to t2 widget but is impossible to write in it.
Is it a swt bug?

Thanks in advance
Re: Problem with focuslost [message #634554 is a reply to message #634395] Fri, 22 October 2010 08:30 Go to previous message
Lakshmi ShanmugamFriend
Messages: 275
Registered: July 2009
Location: India
Senior Member
Hi,

I can reproduce this, but doesn't happen always.
I noticed that after clicking OK, when the mouse is moved over the shell, mouse cursor sometimes changes to ibeam instead of arrow. When you click on the shell or textbox so that the arrow cursor appears, you can start typing again.

This looks like a bug to me. Can you please open a bug report under SWT --> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform &component=SWT

Thanks,


Lakshmi P Shanmugam
Previous Topic:Adding mouse down listener to chevron item in CTabFolder
Next Topic:Text vertical scrollbar not usable on Mac
Goto Forum:
  


Current Time: Mon Dec 18 03:24:07 GMT 2017

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

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