[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.gef] Re: TextFlow doesn't return correct height from getPreferredSize()

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@xxxxxxxxxxx> wrote in message 
news:0ec65e0f1066fe6e24a74776eff50688$1@xxxxxxxxxxxxxxxxxx
>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
>