Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Dialog using run in ApplicationWindow loses focus
Dialog using run in ApplicationWindow loses focus [message #457821] Tue, 05 July 2005 00:44 Go to next message
Chris is currently offline ChrisFriend
Messages: 17
Registered: July 2009
Junior Member
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 #458250 is a reply to message #457821] Mon, 11 July 2005 23:59 Go to previous messageGo to next message
Chris is currently offline ChrisFriend
Messages: 17
Registered: July 2009
Junior Member
Chris wrote:

> 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.

Can anyone tell me if this is the expected behaviour. I'm about to lodge a
bug report, but only if it's not the expected behaviour.
Re: Dialog using run in ApplicationWindow loses focus [message #458256 is a reply to message #458250] Tue, 12 July 2005 12:13 Go to previous messageGo to next message
Billy Biggs is currently offline Billy BiggsFriend
Messages: 94
Registered: July 2009
Member
Chris wrote:
> Chris wrote:
>
>> 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.
>
> [...]
>
> Can anyone tell me if this is the expected behaviour. I'm about to lodge
> a bug report, but only if it's not the expected behaviour.

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
Re: Dialog using run in ApplicationWindow loses focus [message #458405 is a reply to message #458256] Tue, 12 July 2005 23:18 Go to previous message
Chris is currently offline ChrisFriend
Messages: 17
Registered: July 2009
Junior Member
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.
Previous Topic:Column content disappears on collapse and expand of TableTreeViewer
Next Topic:Purpose of TreeViewer with TreeColumns vs. TableTreeViewer?
Goto Forum:
  


Current Time: Wed Dec 02 13:54:50 GMT 2020

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

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

Back to the top