SWT Shell changed behavior in Eclipse 3.1? [message #448867] |
Fri, 14 January 2005 04:51  |
Eclipse User |
|
|
|
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 09:31   |
Eclipse User |
|
|
|
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 09:32   |
Eclipse User |
|
|
|
... 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 #449130 is a reply to message #448879] |
Tue, 18 January 2005 10:46  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.03735 seconds