tags:

views:

420

answers:

2

When I start my SWT Application from Eclipse, the Shell always starts up in the background, with the IDE in front of it.

I tried everything, like setting the focus, activating the shell, etc.

Did someone else experience the same behaviour and maybe even solved it?

A: 

Double check your manifest to see if you're missing anything. That is to say if you are doing this via Eclipse RCP

PSU_Kardi
What do you mean by "check your manifest"? My appname.manifest contains this:<?xml version="1.0" encoding="UTF-8" standalone="yes"?><assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="IKOffice" type="win32"/> <description>IKOffice Product</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/> </dep...> </dep...></ass...>
+1  A: 

When you activate a Shell (usually via the open() method), SWT asks the window manager on your given platform to make the shell active. However, depending on the window manager, the shell might not become the top-most shell on the desktop. Here's an article with some interesting info about opening shells (see section "11.4.6 Opening a Shell").

If this is the cause of your issue, you may be able to use the forceActive() method of the Shell class to force the shell to become active. However, depending on your application, you may not want to adopt this approach. The following is a warning from the article:

Most Programs Should Never Need to Use forceActive()

Forcing a shell to be active should be reserved for those occasions when you must get the attention of the user (which is almost never). After all, do you like it when another window steals your keystrokes?

bporter