Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Splash/Shell resize problems on Linux (Ubuntu 10.04)(Having difficulty shrinking the splash screen)
Splash/Shell resize problems on Linux (Ubuntu 10.04) [message #716834] Thu, 18 August 2011 14:41 Go to next message
Steve Goodrich is currently offline Steve GoodrichFriend
Messages: 13
Registered: February 2010
Location: Colorado
Junior Member
I've implemented an extension to the BasicSplashHandler, although this really has to do with the Shell class. I take the Shell, get its original bounds, add some controls to it, and get the user's login information. Once I have the user's info, I want to restore the Shell to its original size. Here's what I'm doing to restore the Shell:

    void restoreSplashScreen(Shell splash, Rectangle bounds) {
		
        // don't show while we rearrange things
        splash.setVisible(false);

        // now discard our controls and restore the original splash screen
        for (Control control : splash.getChildren()) {
            control.dispose();
        }

        // restore the splash screen size/location
        splash.setBounds(bounds);

        // Now show it
        splash.layout();
        splash.setVisible(true);
    }

On Windows, the Shell returns to normal. On Linux, the Shell stays at its larger size.

I've tried setLocation() and setSize(), pack(), redraw(), and update()... but I can't get this window to return to its original size.

FWIW: the RESIZE style is not set (is there a way to set this after the window is created?), and there is no Layout nor LayoutData associated with the Shell (layout is null).

Can anyone help with this?

Thanks!
-- Steve G.
Re: Splash/Shell resize problems on Linux (Ubuntu 10.04) [message #716894 is a reply to message #716834] Thu, 18 August 2011 17:41 Go to previous messageGo to next message
Thomas Singer is currently offline Thomas SingerFriend
Messages: 75
Registered: July 2009
Member
What layout manager you are using? IMHO setting the bounds is useless if you invoke layout immediately later.
Re: Splash/Shell resize problems on Linux (Ubuntu 10.04) [message #717027 is a reply to message #716894] Fri, 19 August 2011 05:41 Go to previous messageGo to next message
Vijay RajFriend
Messages: 608
Registered: July 2009
Senior Member
Quote:
What layout manager you are using? IMHO setting the bounds is useless if you invoke layout immediately later.


Yes i also agree on this,but if there is no layout management ,then how were you managing the controls which u disposed in your code.

either way layout and bounds are not related unless there is a parent with a layout.(correct me if i am wrong)
try by only setting bounds.


---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
Re: Splash/Shell resize problems on Linux (Ubuntu 10.04) [message #718493 is a reply to message #716834] Wed, 24 August 2011 13:54 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
The lines you've posted seem fine, splash.setBounds() should be all you
need to do since splash doesn't have a Layout set on it. The Shell does
not need the SWT.RESIZE creation style in order for you to change its
bounds, this bit just controls whether resize handles should be
available to the user for dragging.

Is it possible that the setBounds() is succeeding but the size is then
being influenced some time later in your code? After invoking
setBounds() what does getBounds() answer? Does this answer change
later? If none of this sheds any light on what's happening then you
could be seeing a bug, especially since this works on win32 for you. If
you think this is the case then you should log a bug with SWT at
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Platform&component=SWT
for further investigation.

Grant


On 8/18/2011 10:41 AM, Steve Goodrich wrote:
> I've implemented an extension to the BasicSplashHandler, although this
> really has to do with the Shell class. I take the Shell, get its
> original bounds, add some controls to it, and get the user's login
> information. Once I have the user's info, I want to restore the Shell to
> its original size. Here's what I'm doing to restore the Shell:
>
> void restoreSplashScreen(Shell splash, Rectangle bounds) {
>
> // don't show while we rearrange things
> splash.setVisible(false);
>
> // now discard our controls and restore the original splash screen
> for (Control control : splash.getChildren()) {
> control.dispose();
> }
>
> // restore the splash screen size/location
> splash.setBounds(bounds);
>
> // Now show it
> splash.layout();
> splash.setVisible(true);
> }
>
> On Windows, the Shell returns to normal. On Linux, the Shell stays at
> its larger size.
>
> I've tried setLocation() and setSize(), pack(), redraw(), and
> update()... but I can't get this window to return to its original size.
>
> FWIW: the RESIZE style is not set (is there a way to set this after the
> window is created?), and there is no Layout nor LayoutData associated
> with the Shell (layout is null).
>
> Can anyone help with this?
>
> Thanks!
> -- Steve G.
Re: Splash/Shell resize problems on Linux (Ubuntu 10.04) [message #718511 is a reply to message #718493] Wed, 24 August 2011 15:05 Go to previous message
Steve Goodrich is currently offline Steve GoodrichFriend
Messages: 13
Registered: February 2010
Location: Colorado
Junior Member
I tried a few things. Obviously, I'm not an expert in SWT. The attempt at calling layout() (even though the object's Layout and LayoutData are both null) was just a shot in the dark.

During some debugging, I manually set the style bit, and the splash worked. I'm now using reflection to set it, and it works in some cases.

Hmm... as for setBounds()... I was doing a setBounds() call using the original splash screen size every time getSplash() or getContent() was being called, but the window would never shrink/change size.

I've added listeners for every SWT event (even paint and mouse events), but I don't see anything that stands out as patently wrong. Are there some debug settings in SWT which I could enable to get more information?
Previous Topic:dynamic combo generation
Next Topic:SWT Text spell checker
Goto Forum:
  


Current Time: Fri Mar 29 08:21:40 GMT 2024

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

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

Back to the top