Dialog using run in ApplicationWindow loses focus [message #457821] |
Mon, 04 July 2005 20:44  |
Eclipse User |
|
|
|
I have a modal Dialog which uses ApplicationWindow's run method for
starting off a separate thread. I am running on Windows XP.
The issue is that becuase the Dialog has a diffent shell to the
ApplicationWindow the Dialog's shell is disabled causing it to lose its
focused control. The main sympton is that when closing the Dialog
(pressing OK or cancel) there is no focus on the application and the last
focussed window (ie non-swt window, such as a browser or email client,
etc.) is given focus.
The code snippet in question belongs to ApplicationWindow:
Shell shell = getShell();
.........................................................
// Disable the rest of the shells on the current display
Shell[] shells = display.getShells();
boolean[] enabled = new boolean[shells.length];
for (int i = 0; i < shells.length; i++) {
Shell current = shells[i];
if (current == shell) continue;
if (current != null && !current.isDisposed()) {
enabled[i] = current.getEnabled();
current.setEnabled(false);
}
}
Control currentFocus = display.getFocusControl();
Everything works fine if the call to getShell() returns the active shell (
getActiveShell(), ie my Dialog and not the ApplicationWindow).
So my question is, is this incorrect behaviour in SWT? Should it really be
calling getActiveShell()? Or should I not be using ApplicationWindow to
run another thread? If so what is the standard method of doing so out of a
Dialog?
Thanks,
Chris.
|
|
|
|
|
Re: Dialog using run in ApplicationWindow loses focus [message #458405 is a reply to message #458256] |
Tue, 12 July 2005 19:18  |
Eclipse User |
|
|
|
Billy Biggs wrote:
> It sounds suspicious. I think you should file a bug, maybe with a
> bit more code. I'm finding it hard to follow what's going on in your case.
> The bug should probably first be filed against Platform > UI.
> -Billy
Thanks Billy,
I've filed this as bug# 103577, with a snippet as requested.
Chris.
|
|
|
Powered by
FUDForum. Page generated in 0.07710 seconds