Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Dialog using run in ApplicationWindow loses focus
Dialog using run in ApplicationWindow loses focus [message #457821] Mon, 04 July 2005 20:44 Go to next message
Eclipse UserFriend
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 19:59 Go to previous messageGo to next message
Eclipse UserFriend
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 08:13 Go to previous messageGo to next message
Eclipse UserFriend
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 19:18 Go to previous message
Eclipse UserFriend
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 Jul 09 09:22:15 EDT 2025

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

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

Back to the top