Skip to main content



      Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Layout problem
Layout problem [message #491352] Wed, 14 October 2009 05:27 Go to next message
Eclipse UserFriend
Hello,

I have a problem with layout of composites in my application. I am developping an RCP application in which I have a multipage editor. One of the page contains several sections (one above each other).
In one of these sections, I have a composite and two buttons and a grid layout. The composite is two column width, so my buttons are under the composite.

This composite can contain mutliple children and these children can be added/removed by the user at runtime. I use a grid layout in my composite.

The problem is that I can't find a way to automatically resize my section (which contains the composite) when a new child is added/removed in the composite.

I tried to call layout on the composite (the container), and on the section, but the section doesn't resize properly: it keeps the same size. It means that when I add a new child in the container, the child is not visible and the only way to make it visible is to close/reopen the section (in which case, the layout is correct).

What could be the problem ?
Thanks
Re: Layout problem [message #491455 is a reply to message #491352] Wed, 14 October 2009 12:10 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Calling layout() on a Composite does not resize the Composite, it just lays
out its children again. To resize the Composite you should call layout() on
its parent if the parent is using a layout, or pack() the Composite
otherwise.

HTH,
Grant


"C" <cedric.moonen@fmtc.be> wrote in message
news:hb45if$l7b$1@build.eclipse.org...
> Hello,
>
> I have a problem with layout of composites in my application. I am
developping an RCP application in which I have a multipage editor. One of
the page contains several sections (one above each other).
> In one of these sections, I have a composite and two buttons and a grid
layout. The composite is two column width, so my buttons are under the
composite.
>
> This composite can contain mutliple children and these children can be
added/removed by the user at runtime. I use a grid layout in my composite.
>
> The problem is that I can't find a way to automatically resize my section
(which contains the composite) when a new child is added/removed in the
composite.
>
> I tried to call layout on the composite (the container), and on the
section, but the section doesn't resize properly: it keeps the same size. It
means that when I add a new child in the container, the child is not visible
and the only way to make it visible is to close/reopen the section (in which
case, the layout is correct).
>
> What could be the problem ?
> Thanks
Re: Layout problem [message #491576 is a reply to message #491455] Thu, 15 October 2009 03:15 Go to previous message
Eclipse UserFriend
Hi Grant,

Thanks for your answer. I now call layout() on the top parent (the form body of the editor page) and this seems to fix the problem.

Thanks !
Cédric
Previous Topic:Update DragSourceEvent.image while dragging
Next Topic:How to keep the same ratio between width and height of a Shell when it is resized ?
Goto Forum:
  


Current Time: Wed Jul 23 12:24:55 EDT 2025

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

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

Back to the top