Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » TextFlow doesn't return correct height from getPreferredSize()
TextFlow doesn't return correct height from getPreferredSize() [message #210319] Fri, 24 February 2006 21:14 Go to next message
Nathan Snapp is currently offline Nathan SnappFriend
Messages: 14
Registered: July 2009
Junior Member
I have a custom figure with a FlowPage contianing 2 TextFlows with
different fonts. For some reason the TextFlows layout correctly width-wise
and wrap if they are supposed to, but when my custom figure returns the
sum of the height of the TextFlows called by getPreferredSize(-1,-1) it
gets the size as if the TextFlows were on one line. I notice that this is
because the Figure.bounds variable of the TextFlows are already set. If I
repaint the figure (My canvas is in a ScrolledForm that gets reflow()'ed)
the TextFlow's bounds gets set correctly.

Any idea why this might be happening. I understand that InlineFlows get
laid out differently than most figures.

TIA,
Nate
Re: TextFlow doesn't return correct height from getPreferredSize() [message #210337 is a reply to message #210319] Sat, 25 February 2006 16:38 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

Any time you call getPreferredSize, the current state of the figure is not
important. You are asking the figure for its size with no width (or height)
constraint. The result is that everything will be on 1 line. If you want the
preferred size with wrapping, tell it where to wrap with wHint.

"Nathan Snapp" <nathan.snapp@altiris.com> wrote in message
news:0ec65e0f1066fe6e24a74776eff50688$1@www.eclipse.org...
>I have a custom figure with a FlowPage contianing 2 TextFlows with
>different fonts. For some reason the TextFlows layout correctly width-wise
>and wrap if they are supposed to, but when my custom figure returns the sum
>of the height of the TextFlows called by getPreferredSize(-1,-1) it gets
>the size as if the TextFlows were on one line. I notice that this is
>because the Figure.bounds variable of the TextFlows are already set. If I
>repaint the figure (My canvas is in a ScrolledForm that gets reflow()'ed)
>the TextFlow's bounds gets set correctly.
>
> Any idea why this might be happening. I understand that InlineFlows get
> laid out differently than most figures.
>
> TIA,
> Nate
>
Previous Topic:How can I reverse the direction of the Y axis?
Next Topic:How do i add Alignment Actions etc. ?
Goto Forum:
  


Current Time: Thu Mar 28 23:19:13 GMT 2024

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

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

Back to the top