Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SWT Shell changed behavior in Eclipse 3.1?
SWT Shell changed behavior in Eclipse 3.1? [message #448867] Fri, 14 January 2005 09:51 Go to next message
Rainer is currently offline RainerFriend
Messages: 21
Registered: July 2009
Junior Member
I have recently moved from Eclipse 3.0 to 3.1 (tried both M3 and M4). My
problem: From my RCP app, I am opening a new shell using the following
code:


Shell shell = new Shell(SWT.ON_TOP | SWT.CLOSE | SWT.TITLE | SWT.RESIZE);
shell.setBounds(100,100,640,480);
shell.setText("Title");

GridLayout layout = new GridLayout(1, true);
layout.marginWidth = 1;
layout.marginHeight = 1;
shell.setLayout(layout);

browser = new Browser(shell, SWT.NONE);
browser.setLayoutData(new
GridData(GridData.FILL_BOTH|GridData.GRAB_HORIZONTAL));

label = new Label(shell, SWT.NONE);
label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
GridData.GRAB_HORIZONTAL));
label.setText("Single click selects elements.");

shell.open();


This used to work perfect in Eclipse 3.0. But in 3.1, the shell opens
empty, i.e. without any widgets. Could this be a bug in Eclipse 3.1 or is
something in my code "dirty" that Eclipse 3.0 used to tolerate, but 3.1 no
longer does?

Thanks for any advice!

-Ray
Re: SWT Shell changed behavior in Eclipse 3.1? [message #448875 is a reply to message #448867] Fri, 14 January 2005 14:31 Go to previous messageGo to next message
Rainer is currently offline RainerFriend
Messages: 21
Registered: July 2009
Junior Member
Just some added Info to my problem that might be useful: the widgets that
are appended to the shell (in the example below a browser and a label,
though I tried all sorts of widgets and it doesn't make a difference) are
"technically" there, i.e. I can access them with getting Nullpointer
exceptions. For some strange reason they are just not drawn onto the
shell. P.S.: redraw & update don't help either.

Hm... It looks like a bug to me. Hopefully someone can comment on this!

Thanks in advance!

Ray

Rainer wrote:

> I have recently moved from Eclipse 3.0 to 3.1 (tried both M3 and M4). My
> problem: From my RCP app, I am opening a new shell using the following
> code:


> Shell shell = new Shell(SWT.ON_TOP | SWT.CLOSE | SWT.TITLE | SWT.RESIZE);
> shell.setBounds(100,100,640,480);
> shell.setText("Title");

> GridLayout layout = new GridLayout(1, true);
> layout.marginWidth = 1;
> layout.marginHeight = 1;
> shell.setLayout(layout);

> browser = new Browser(shell, SWT.NONE);
> browser.setLayoutData(new
> GridData(GridData.FILL_BOTH|GridData.GRAB_HORIZONTAL));

> label = new Label(shell, SWT.NONE);
> label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
> GridData.GRAB_HORIZONTAL));
> label.setText("Single click selects elements.");

> shell.open();


> This used to work perfect in Eclipse 3.0. But in 3.1, the shell opens
> empty, i.e. without any widgets. Could this be a bug in Eclipse 3.1 or is
> something in my code "dirty" that Eclipse 3.0 used to tolerate, but 3.1 no
> longer does?

> Thanks for any advice!

> -Ray
Re: SWT Shell changed behavior in Eclipse 3.1? [message #448876 is a reply to message #448875] Fri, 14 January 2005 14:32 Go to previous messageGo to next message
Rainer is currently offline RainerFriend
Messages: 21
Registered: July 2009
Junior Member
... I can access the widgets WITHOUT getting a Nullpointer Exception (just
correcting a typing error in my last post. sorry)

Rainer wrote:

> Just some added Info to my problem that might be useful: the widgets that
> are appended to the shell (in the example below a browser and a label,
> though I tried all sorts of widgets and it doesn't make a difference) are
> "technically" there, i.e. I can access them with getting Nullpointer
> exceptions. For some strange reason they are just not drawn onto the
> shell. P.S.: redraw & update don't help either.

> Hm... It looks like a bug to me. Hopefully someone can comment on this!

> Thanks in advance!

> Ray

> Rainer wrote:

>> I have recently moved from Eclipse 3.0 to 3.1 (tried both M3 and M4). My
>> problem: From my RCP app, I am opening a new shell using the following
>> code:


>> Shell shell = new Shell(SWT.ON_TOP | SWT.CLOSE | SWT.TITLE | SWT.RESIZE);
>> shell.setBounds(100,100,640,480);
>> shell.setText("Title");

>> GridLayout layout = new GridLayout(1, true);
>> layout.marginWidth = 1;
>> layout.marginHeight = 1;
>> shell.setLayout(layout);

>> browser = new Browser(shell, SWT.NONE);
>> browser.setLayoutData(new
>> GridData(GridData.FILL_BOTH|GridData.GRAB_HORIZONTAL));

>> label = new Label(shell, SWT.NONE);
>> label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL |
>> GridData.GRAB_HORIZONTAL));
>> label.setText("Single click selects elements.");

>> shell.open();


>> This used to work perfect in Eclipse 3.0. But in 3.1, the shell opens
>> empty, i.e. without any widgets. Could this be a bug in Eclipse 3.1 or is
>> something in my code "dirty" that Eclipse 3.0 used to tolerate, but 3.1 no
>> longer does?

>> Thanks for any advice!

>> -Ray
Re: SWT Shell changed behavior in Eclipse 3.1? [message #448879 is a reply to message #448876] Fri, 14 January 2005 15:21 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Move your setBounds of shell to the end before the shell.open(). I've
seen this happen on different systems. Some systems doing the setbounds
before adding all of the children works sometimes it doesn't.

Basically what is happening is when you do the setBounds a layout
occurs, but there are no children, so nothing is layed out. Adding
children DOES NOT cause a layout to occur. Only resizes or explicit
calls to layout cause layout to occur. So when it finally becomes
visible no layout occurs because no resize had occurred.

I think some systems cause a resize to occur on the first show, and
others don't.



--
Thanks,
Rich Kulp
Re: SWT Shell changed behavior in Eclipse 3.1? [message #448880 is a reply to message #448879] Fri, 14 January 2005 15:36 Go to previous messageGo to next message
Rainer is currently offline RainerFriend
Messages: 21
Registered: July 2009
Junior Member
You saved my day! (And my weekend :-) It works. Thanks a lot!!

-Ray

Rich Kulp wrote:

> Move your setBounds of shell to the end before the shell.open(). I've
> seen this happen on different systems. Some systems doing the setbounds
> before adding all of the children works sometimes it doesn't.

> Basically what is happening is when you do the setBounds a layout
> occurs, but there are no children, so nothing is layed out. Adding
> children DOES NOT cause a layout to occur. Only resizes or explicit
> calls to layout cause layout to occur. So when it finally becomes
> visible no layout occurs because no resize had occurred.

> I think some systems cause a resize to occur on the first show, and
> others don't.
Re: SWT Shell changed behavior in Eclipse 3.1? [message #449130 is a reply to message #448879] Tue, 18 January 2005 15:46 Go to previous message
Steve Northover is currently offline Steve NorthoverFriend
Messages: 1636
Registered: July 2009
Senior Member
You are correct. As of 3.1, the behavior is consistent on all platforms.

"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:cs8o2n$n9d$1@www.eclipse.org...
> Move your setBounds of shell to the end before the shell.open(). I've
> seen this happen on different systems. Some systems doing the setbounds
> before adding all of the children works sometimes it doesn't.
>
> Basically what is happening is when you do the setBounds a layout
> occurs, but there are no children, so nothing is layed out. Adding
> children DOES NOT cause a layout to occur. Only resizes or explicit
> calls to layout cause layout to occur. So when it finally becomes
> visible no layout occurs because no resize had occurred.
>
> I think some systems cause a resize to occur on the first show, and
> others don't.
>
>
>
> --
> Thanks,
> Rich Kulp
Previous Topic:Tool tip with F2 for focus
Next Topic:Multi-Threaded Applications
Goto Forum:
  


Current Time: Fri Apr 19 03:35:00 GMT 2024

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

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

Back to the top