Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Find max available space for figure in ToolbarLayout
Find max available space for figure in ToolbarLayout [message #175081] Sat, 02 April 2005 08:17 Go to next message
Eclipse UserFriend
Originally posted by: tuhlmann.gmx.de

Hi,

I have several composite figures that are managed by a ToolbarLayout
(vertical).
They hold two Label figures and a shape. When the compound figure is
created with a given bounds size or when the user resizes the figure I
want the shape to occupy all available space.

However I did not find an easy way to calculate this. What I do now is
to first set the font of the labels and then calculate their preferred
sizes, subtract them together with layout spacing from the overall
height of the compound figure. This meachanism doesn't really work well.
When the figure is created first it draws a few pixel to large. However
when I move it around it suddenly draws correctly.

What is your advice? Should I write my own LayoutManager?

thanks,
Torsten.
Re: Find max available space for figure in ToolbarLayout [message #175223 is a reply to message #175081] Mon, 04 April 2005 03:34 Go to previous messageGo to next message
Pratik Shah is currently offline Pratik ShahFriend
Messages: 1077
Registered: July 2009
Senior Member
So you've subclassed ToolbarLayout? What are you doing in there? All you
need to do is override layout(). Call super and let it do all the laying
out. Then in your method, just set the bounds of the last child to take up
any remaining vertical space, if there is any.

One workaround is to use the border layout. The center is given all
leftover space.

"Torsten Uhlmann" <tuhlmann@gmx.de> wrote in message
news:d2lkim$mit$1@news.eclipse.org...
> Hi,
>
> I have several composite figures that are managed by a ToolbarLayout
> (vertical).
> They hold two Label figures and a shape. When the compound figure is
> created with a given bounds size or when the user resizes the figure I
> want the shape to occupy all available space.
>
> However I did not find an easy way to calculate this. What I do now is
> to first set the font of the labels and then calculate their preferred
> sizes, subtract them together with layout spacing from the overall
> height of the compound figure. This meachanism doesn't really work well.
> When the figure is created first it draws a few pixel to large. However
> when I move it around it suddenly draws correctly.
>
> What is your advice? Should I write my own LayoutManager?
>
> thanks,
> Torsten.
Re: Find max available space for figure in ToolbarLayout [message #175254 is a reply to message #175223] Mon, 04 April 2005 06:42 Go to previous message
Eclipse UserFriend
Originally posted by: tuhlmann.gmx.de

No, I didn't. I just asked if I should.
But the problem seems to disappear when I properly set the font of the
two labels involved in the figure.

Torsten.

Pratik Shah wrote:
> So you've subclassed ToolbarLayout? What are you doing in there? All you
> need to do is override layout(). Call super and let it do all the laying
> out. Then in your method, just set the bounds of the last child to take up
> any remaining vertical space, if there is any.
>
> One workaround is to use the border layout. The center is given all
> leftover space.
>
> "Torsten Uhlmann" <tuhlmann@gmx.de> wrote in message
> news:d2lkim$mit$1@news.eclipse.org...
>
>>Hi,
>>
>>I have several composite figures that are managed by a ToolbarLayout
>>(vertical).
>>They hold two Label figures and a shape. When the compound figure is
>>created with a given bounds size or when the user resizes the figure I
>>want the shape to occupy all available space.
>>
>>However I did not find an easy way to calculate this. What I do now is
>>to first set the font of the labels and then calculate their preferred
>>sizes, subtract them together with layout spacing from the overall
>>height of the compound figure. This meachanism doesn't really work well.
>>When the figure is created first it draws a few pixel to large. However
>>when I move it around it suddenly draws correctly.
>>
>>What is your advice? Should I write my own LayoutManager?
>>
>>thanks,
>>Torsten.
>
>
>
Previous Topic:Figures as visual representation of TreeItems?
Next Topic:Help Need: No more handles
Goto Forum:
  


Current Time: Sat Feb 04 03:56:54 GMT 2023

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

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

Back to the top