Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Strange Shell behaviour
Strange Shell behaviour [message #453939] Thu, 14 April 2005 12:59 Go to next message
hortiz Mising name is currently offline hortiz Mising nameFriend
Messages: 96
Registered: July 2009
Member
Hi,

I used in my application a Shell with ALWAYS_ON_TOP style, to allow users
to always see some important information (server alarms, ...).

I work on Linux with SuSE 8.2.

But if the user clickes on the clock in the task bar while this shell is
displayed, it disappears.

Here is a sample code (two classes: Main.java and SpyContainer.java)

/*** Main.java ******************************/
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class Main {

private static Display display;

public static void main(String[] args) {

display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new GridLayout());

Button openSpyButton = new Button(shell, SWT.PUSH);
openSpyButton.setText("Open Spy");
openSpyButton.setLayoutData(new GridData());
openSpyButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
SpyContainer spyContainer = new SpyContainer(display);
spyContainer.getSpyComposite().layout();
}
});

shell.open();

while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}


/*** SpyContainer.java **********************/

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class SpyContainer {

private Shell spyShell;
private Composite spyComposite;

public SpyContainer(Display display) {

spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP);
// spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP |
SWT.PRIMARY_MODAL);
// spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP |
SWT.APPLICATION_MODAL);
// spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP |
SWT.SYSTEM_MODAL);
// spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP |
SWT.MODELESS);

spyShell.setLayout(new FillLayout(SWT.VERTICAL));
spyComposite = new Composite(spyShell, SWT.NONE);
spyComposite.setLayout(new GridLayout());

spyComposite.setBackground(display.getSystemColor(SWT.COLOR_ DARK_RED));

Label spyLabel = new Label(spyComposite, SWT.NONE);
spyLabel.setText("Spy Label");
spyLabel.setLayoutData(new GridData());
spyShell.setSize(300, 300);
spyShell.open();
}

public Composite getSpyComposite() {
return spyComposite;
}
}
Re: Strange Shell behaviour [message #453942 is a reply to message #453939] Thu, 14 April 2005 13:55 Go to previous messageGo to next message
hortiz Mising name is currently offline hortiz Mising nameFriend
Messages: 96
Registered: July 2009
Member
For information, I have test my code on Debian and there is no problem...
Re: Strange Shell behaviour [message #453946 is a reply to message #453939] Thu, 14 April 2005 14:45 Go to previous messageGo to next message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
No idea why this would happen. ON_TOP shells override the window manager so
it should not be hiding it. Try creating the spy as a child of the other
shell?

"hortiz" <hortiz@xxxxx.com> wrote in message
news:3cb48cd36c1972c97b862078d7e23aee$1@www.eclipse.org...
> Hi,
>
> I used in my application a Shell with ALWAYS_ON_TOP style, to allow users
> to always see some important information (server alarms, ...).
>
> I work on Linux with SuSE 8.2.
>
> But if the user clickes on the clock in the task bar while this shell is
> displayed, it disappears.
>
> Here is a sample code (two classes: Main.java and SpyContainer.java)
>
> /*** Main.java ******************************/
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.events.SelectionAdapter;
> import org.eclipse.swt.events.SelectionEvent;
> import org.eclipse.swt.layout.GridData;
> import org.eclipse.swt.layout.GridLayout;
> import org.eclipse.swt.widgets.Button;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
>
> public class Main {
>
> private static Display display;
>
> public static void main(String[] args) {
>
> display = new Display ();
> Shell shell = new Shell (display);
> shell.setLayout(new GridLayout());
>
> Button openSpyButton = new Button(shell, SWT.PUSH);
> openSpyButton.setText("Open Spy");
> openSpyButton.setLayoutData(new GridData());
> openSpyButton.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(SelectionEvent event) {
> SpyContainer spyContainer = new SpyContainer(display);
> spyContainer.getSpyComposite().layout();
> }
> });
>
> shell.open();
>
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch()) {
> display.sleep();
> }
> }
> display.dispose();
> }
> }
>
>
> /*** SpyContainer.java **********************/
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.layout.GridData;
> import org.eclipse.swt.layout.GridLayout;
> import org.eclipse.swt.widgets.Composite;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.widgets.Shell;
>
> public class SpyContainer {
>
> private Shell spyShell;
> private Composite spyComposite;
>
> public SpyContainer(Display display) {
>
> spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP);
> // spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP |
> SWT.PRIMARY_MODAL);
> // spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP |
> SWT.APPLICATION_MODAL);
> // spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP |
> SWT.SYSTEM_MODAL);
> // spyShell = new Shell(display, SWT.NO_TRIM | SWT.ON_TOP |
> SWT.MODELESS);
>
> spyShell.setLayout(new FillLayout(SWT.VERTICAL));
> spyComposite = new Composite(spyShell, SWT.NONE);
> spyComposite.setLayout(new GridLayout());
>
> spyComposite.setBackground(display.getSystemColor(SWT.COLOR_ DARK_RED));
>
> Label spyLabel = new Label(spyComposite, SWT.NONE);
> spyLabel.setText("Spy Label");
> spyLabel.setLayoutData(new GridData());
> spyShell.setSize(300, 300);
> spyShell.open();
> }
>
> public Composite getSpyComposite() {
> return spyComposite;
> }
> }
>
>
>
Re: Strange Shell behaviour [message #453947 is a reply to message #453946] Thu, 14 April 2005 15:20 Go to previous messageGo to next message
hortiz Mising name is currently offline hortiz Mising nameFriend
Messages: 96
Registered: July 2009
Member
Hi Steve,

>>> Try creating the spy as a child of the other shell ?

I still have the same problem...
Did you manage to reproduce it ?

Helene
Re: Strange Shell behaviour [message #454179 is a reply to message #453947] Mon, 18 April 2005 20:11 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
Nope.

"hortiz" <hortiz@xxxxx.com> wrote in message
news:328f778bec36593db9170c31bb4ff4ac$1@www.eclipse.org...
> Hi Steve,
>
> >>> Try creating the spy as a child of the other shell ?
>
> I still have the same problem...
> Did you manage to reproduce it ?
>
> Helene
>
>
>
>
Previous Topic:Text validation and setting focus
Next Topic:Hide a coolbar
Goto Forum:
  


Current Time: Fri Mar 05 08:25:19 GMT 2021

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

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

Back to the top