[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Widgets not shown until the shell is resized

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@xxxxxxxxx> wrote in message news:cnjbjq$l7g$1@xxxxxxxxxxxxxxxxxx
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