Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Widgets not shown until the shell is resized
Widgets not shown until the shell is resized [message #446174] Thu, 18 November 2004 23:17 Go to next message
Mark McLaren is currently offline Mark McLarenFriend
Messages: 45
Registered: July 2009
Member
I'm finding my widgets aren't being displayed until I resize the shell
they are in - then suddenly they appear!

What method do I need to call to make them appear? These don't seem to
work:
panel.layout(true)
panel.getShell().redraw()
Re: Widgets not shown until the shell is resized [message #446175 is a reply to message #446174] Thu, 18 November 2004 23:36 Go to previous messageGo to next message
Christian Hauser is currently offline Christian HauserFriend
Messages: 189
Registered: July 2009
Senior Member
Mark McLaren wrote:
> I'm finding my widgets aren't being displayed until I resize the shell
> they are in - then suddenly they appear!
>
> What method do I need to call to make them appear? These don't seem to
> work:
> panel.layout(true) panel.getShell().redraw()

What happens if you call panel.getShell().layout(true)? Try calling
layout(true) on different panels to see if it makes a difference.

Had this problem, too, some time ago and layout(true) on the right
composite helped.

HTH,
Christian
Re: Widgets not shown until the shell is resized [message #446180 is a reply to message #446175] Fri, 19 November 2004 12:12 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
The way Composite.layout(true) works is that the composite you call it on
(panel in your case) will update the size and location of its direct
children. If any of the children are resized as a result of this action,
the resized child will also have a layout performed. However, the following
conditions apply 1) the child must have a Layout assigned to it and 2) the
cache will not be flushed (equivalent of calling (layout(false)). If a
child does not change size, it will not get laid out. What often happens is
that there will be some Composite that has a fixed size (call it C). If you
make a change to a child of C then call layout(true) on any of the parents
of C, nothing will get laid out in C. You must call layout(true) on C.

In 3.1 we are adding new API to make this easier. See
Composite.layout(boolean changed, boolean all) and
Composite.layout(Control[]).

"Christian Hauser" <c.hauser@active.ch> wrote in message
news:cnjbjq$l7g$1@www.eclipse.org...
> Mark McLaren wrote:
>> I'm finding my widgets aren't being displayed until I resize the shell
>> they are in - then suddenly they appear!
>>
>> What method do I need to call to make them appear? These don't seem to
>> work:
>> panel.layout(true) panel.getShell().redraw()
>
> What happens if you call panel.getShell().layout(true)? Try calling
> layout(true) on different panels to see if it makes a difference.
>
> Had this problem, too, some time ago and layout(true) on the right
> composite helped.
>
> HTH,
> Christian
Re: Widgets not shown until the shell is resized [message #446194 is a reply to message #446180] Fri, 19 November 2004 21:28 Go to previous messageGo to next message
Mark McLaren is currently offline Mark McLarenFriend
Messages: 45
Registered: July 2009
Member
Thanks for the response, but it turned out to be a much simpler fix: call
getShell().setSize() after adding the widgets to the panel.

Mark

Veronika Irvine wrote:

> The way Composite.layout(true) works is that the composite you call it on
> (panel in your case) will update the size and location of its direct
> children. If any of the children are resized as a result of this action,
> the resized child will also have a layout performed. However, the following
> conditions apply 1) the child must have a Layout assigned to it and 2) the
> cache will not be flushed (equivalent of calling (layout(false)). If a
> child does not change size, it will not get laid out. What often happens is
> that there will be some Composite that has a fixed size (call it C). If you
> make a change to a child of C then call layout(true) on any of the parents
> of C, nothing will get laid out in C. You must call layout(true) on C.

> In 3.1 we are adding new API to make this easier. See
> Composite.layout(boolean changed, boolean all) and
> Composite.layout(Control[]).

> "Christian Hauser" <c.hauser@active.ch> wrote in message
> news:cnjbjq$l7g$1@www.eclipse.org...
>> Mark McLaren wrote:
>>> I'm finding my widgets aren't being displayed until I resize the shell
>>> they are in - then suddenly they appear!
>>>
>>> What method do I need to call to make them appear? These don't seem to
>>> work:
>>> panel.layout(true) panel.getShell().redraw()
>>
>> What happens if you call panel.getShell().layout(true)? Try calling
>> layout(true) on different panels to see if it makes a difference.
>>
>> Had this problem, too, some time ago and layout(true) on the right
>> composite helped.
>>
>> HTH,
>> Christian
Re: Widgets not shown until the shell is resized [message #446202 is a reply to message #446194] Fri, 19 November 2004 23:02 Go to previous message
Daniel Spiewak is currently offline Daniel SpiewakFriend
Messages: 263
Registered: July 2009
Senior Member
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Luxi Sans"><font face="serif">Both fixes are more or less
the same.  Except for the fact that I like to set the Shell size in the
constructor, that'd be pretty good.  I'm rather pleased that 3.1 will
include a better way of doing this.  I'm rather pleased with the SWT
3.1 effort altogether.  Way to go guys!<br>
<br>
Daniel</font><br>
</font><br>
Mark McLaren wrote:
<blockquote cite="midcnloih$7iq$1@www.eclipse.org" type="cite">Thanks
for the response, but it turned out to be a much simpler fix: call
getShell().setSize() after adding the widgets to the panel.
<br>
<br>
Mark
<br>
<br>
Veronika Irvine wrote:
<br>
<br>
<blockquote type="cite">The way Composite.layout(true) works is that
the composite you call it on (panel in your case) will update the size
and location of its direct children.  If any of the children are
resized as a result of this action, the resized child will also have a
layout performed.  However, the following conditions apply 1) the child
must have a Layout assigned to it and 2) the cache will not be flushed
(equivalent of calling (layout(false)).  If a child does not change
size, it will not get laid out.  What often happens is that there will
be some Composite that has a fixed size (call it C).  If you make a
change to a child of C then call layout(true) on any of the parents of
C, nothing will get laid out in C.  You must call layout(true) on C.
<br>
</blockquote>
<br>
<blockquote type="cite">In 3.1 we are adding new API to make this
easier.  See Composite.layout(boolean changed, boolean all) and
Composite.layout(Control[]).
<br>
</blockquote>
<br>
<blockquote type="cite">"Christian Hauser" <a class="moz-txt-link-rfc2396E" href="mailto:c.hauser@active.ch">&lt;c.hauser@active.ch&gt;</a>
wrote in message <a class="moz-txt-link-freetext" href="news:cnjbjq$l7g$1@www.eclipse.org">news:cnjbjq$l7g$1@www.eclipse.org</a>...
<br>
<blockquote type="cite">Mark McLaren wrote:
<br>
<blockquote type="cite">I'm finding my widgets aren't being
displayed until I resize the shell they are in - then suddenly they
appear!
<br>
<br>
What method do I need to call to make them appear?  These don't seem to
work:
<br>
panel.layout(true) panel.getShell().redraw()
<br>
</blockquote>
<br>
What happens if you call panel.getShell().layout(true)? Try calling
layout(true) on different panels to see if it makes a difference.
<br>
<br>
Had this problem, too, some time ago and layout(true) on the right
composite helped.
<br>
<br>
HTH,
<br>
  Christian
<br>
</blockquote>
</blockquote>
<br>
<br>
</blockquote>
</body>
</html>
Previous Topic:Ghost Image and Cursor
Next Topic:[Mac] Shell.getMaximized() always returning TRUE?
Goto Forum:
  


Current Time: Fri Apr 19 08:37:57 GMT 2024

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

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

Back to the top