Find max available space for figure in ToolbarLayout [message #175081] |
Sat, 02 April 2005 08:17 |
Eclipse User |
|
|
|
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 #175254 is a reply to message #175223] |
Mon, 04 April 2005 06:42 |
Eclipse User |
|
|
|
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.
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03412 seconds