Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Hide Shell(Prevent a window from opening until a user wishes)
Hide Shell [message #734724] Sun, 09 October 2011 11:23 Go to next message
Mark Fenbers is currently offline Mark Fenbers
Messages: 45
Registered: July 2009
Location: Ohio, USA
Member
I need to open a shell window to respond to events even though the window is hidden until a user wants to see it. It all works except that the window appears briefly just after the open() method before going into hiding (because setVisible(false) is called immediately after the open() method).

I tried putting setVisible(false) in the configureShell() method and in the createContents() method, but it seems to be ignored there. I also tried putting setShellStyle(SWT.Hide) just prior to Open(), but that also is ignored.

So how do I create a window without it appearing even for a moment?
Mark
Re: Hide Shell [message #735053 is a reply to message #734724] Mon, 10 October 2011 15:20 Go to previous messageGo to next message
Lakshmi Shanmugam
Messages: 274
Registered: July 2009
Location: India
Senior Member
Hi,

The window appears because Shell.open() marks the window as visible and makes it the active shell (please see the javadoc of Shell.open()). So, don't call open() until you want to show the window.


Lakshmi P Shanmugam

[Updated on: Mon, 10 October 2011 15:20]

Report message to a moderator

Re: Hide Shell [message #735144 is a reply to message #735053] Tue, 11 October 2011 00:35 Go to previous messageGo to next message
Vijay Raj
Messages: 608
Registered: July 2009
Senior Member
Just Out of curiosity,
Why do you require a window shell without visibility?


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: Hide Shell [message #736002 is a reply to message #735053] Thu, 13 October 2011 06:43 Go to previous messageGo to next message
Mark Fenbers is currently offline Mark Fenbers
Messages: 45
Registered: July 2009
Location: Ohio, USA
Member
I believe I need to call open() in order to build the window containing a number of dynamic controls that get updated through a separate thread. A toggle button is available to allow the window to be hidden or shown at will, but even when hidden, the window needs to be updated so that it will have latest information when the user chooses to show it. I believe the best approach for this behavior is to show/hide the window using setVisible() rather than using open() and close(), correct?
Mark
Re: Hide Shell [message #736005 is a reply to message #735053] Thu, 13 October 2011 06:43 Go to previous messageGo to next message
Mark is currently offline Mark
Messages: 61
Registered: July 2009
Member
I believe I need to call open() in order to build the window containing a number of dynamic controls that get updated through a separate thread. A toggle button is available to allow the window to be hidden or shown at will, but even when hidden, the window needs to be updated so that it will have latest information when the user chooses to show it. I believe the best approach for this behavior is to show/hide the window using setVisible() rather than using open() and close(), correct?
Mark
Re: Hide Shell [message #736006 is a reply to message #735144] Thu, 13 October 2011 06:46 Go to previous messageGo to next message
Mark Fenbers is currently offline Mark Fenbers
Messages: 45
Registered: July 2009
Location: Ohio, USA
Member
The window shows supplemental information. The user is to have the ability to show or hide this at will.
Re: Hide Shell [message #736890 is a reply to message #736006] Fri, 14 October 2011 08:41 Go to previous messageGo to next message
Lakshmi Shanmugam
Messages: 274
Registered: July 2009
Location: India
Senior Member
The window is created when you call new Shell(). Shell.open() moves the receiver to the top of the drawing order, marks it visible, sets the focus and asks the window manager to make the shell active (from the javadoc).
So, you will be able to add the controls to the Shell even if you have not called open().
You can choose to show the Shell either using Shell.open() or Shell.setVisible(true). And hide the Shell using Shell.setVisible(false) (Shell.close() will dispose the shell)





Lakshmi P Shanmugam

[Updated on: Fri, 14 October 2011 08:42]

Report message to a moderator

Re: Hide Shell [message #737196 is a reply to message #736890] Fri, 14 October 2011 15:22 Go to previous message
Mark Fenbers is currently offline Mark Fenbers
Messages: 45
Registered: July 2009
Location: Ohio, USA
Member
Sweet! (or should I say "SWT!"?)

I commented out open() and replaced it with createShell(), createContents(), setActive() and setVisible(false) to get the behavior I wanted. I also had to override getShell() to return the one given me from the call to createShell().

Thanks for the help! I'm all fixed!
Mark
Previous Topic:SWT / Android
Next Topic:huge polyline performance
Goto Forum:
  


Current Time: Thu Apr 24 14:43:59 EDT 2014

Powered by FUDForum. Page generated in 0.04740 seconds