Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Layout problem
Layout problem [message #491352] Wed, 14 October 2009 09:27 Go to next message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
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 16:10 Go to previous messageGo to next message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2151
Registered: July 2009
Senior Member
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 07:15 Go to previous message
Cedric Moonen is currently offline Cedric MoonenFriend
Messages: 274
Registered: August 2009
Senior Member
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: Fri Aug 23 03:16:21 GMT 2019

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

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

Back to the top