Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to tell what control is gaining focus when I'm losing focus?
How to tell what control is gaining focus when I'm losing focus? [message #459565] Wed, 10 August 2005 23:20 Go to next message
Mark McLaren is currently offline Mark McLarenFriend
Messages: 45
Registered: July 2009
Member
Is there any way to tell what control is gaining focus when my control
loses it? In Swing, I could use the field FocusEvent.opposite. Is there
any equivalent for SWT?

Thanks
Re: How to tell what control is gaining focus when I'm losing focus? [message #459586 is a reply to message #459565] Thu, 11 August 2005 17:38 Go to previous message
Eclipse UserFriend
Originally posted by: mehow.remove.neurosoft.net

Try Display.getFocusControl(). If it doesn't in focusLost(), try such a
trick:

public void focusLost(FocusEvent event) {
final Display display = event.getDisplay();

display.asyncExec(new Runnable() {
public void run() {
Control focusControl
= display.getFocusControl();
...
}
}
}

The code will not be executed at once, but you won't see the difference,
and Display.getFocusControl() should return the right control.

Michal


Mark McLaren napisaƂ(a):
> Is there any way to tell what control is gaining focus when my control
> loses it? In Swing, I could use the field FocusEvent.opposite. Is
> there any equivalent for SWT?
>
> Thanks
>
Previous Topic:FormLayout problem, using relative sizes
Next Topic:ilding JFace/SWT apps in WSAD? Getting NoClassDefFoundError
Goto Forum:
  


Current Time: Mon Apr 19 10:35:43 GMT 2021

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

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

Back to the top