Does a Form with TableWrapLayout allow child FigureCanvas? [message #211432] |
Fri, 10 March 2006 17:41  |
Eclipse User |
|
|
|
I have a ScrolledForm with a TableWrapLayout. As a child to this form I
have one or more FigureCanvas's. I chose FigureCanvas because I want to
have wrapped text with a box around it, so I am using a Figure with
TextFlows contained in a PageFlow and a border drawn around the whole
thing. They wrap just fine, but the TableWrapLayout causes them to be
clipped if the lines wrap. Is TableWrapLayout not meant for this?
If not is this the wrong approach? I would really like to put
FigureCanvases into a TableWrapLayout even if it means submitting a patch,
but I want to know if What I am trying to do is just WRONG! :)
Thanks!
|
|
|
|
Re: Does a Form with TableWrapLayout allow child FigureCanvas? [message #211464 is a reply to message #211456] |
Mon, 13 March 2006 00:42  |
Eclipse User |
|
|
|
Once again, stepping through the code in all its gory detail has yielded
an answer :)
The problem is the Section extends ExpandableComposite which ignores the
SWT.WRAP flag if it's child is a Composite and instead looks to see if the
Composite's layout implements ILayoutExtension (which is used for wrapping
calculations). So I ended up rolling my own layout (just copying
FillLayout and FillData into my own classes since they are final and
non-public respectively). In the class representing FillLayout you need
to implement ILayoutExtension and provide functions computeMaximumWidth
and computeMinimumWidth.
Here are my implementations if anyone cares:
public int computeMaximumWidth(Composite parent, boolean changed) {
return computeSize(parent, SWT.DEFAULT, SWT.DEFAULT, changed).x;
}
public int computeMinimumWidth(Composite parent, boolean changed) {
return computeSize(parent, 0, SWT.DEFAULT, changed).x;
}
Hopes this helps someone who may tread down this same confusing path!
|
|
|
Powered by
FUDForum. Page generated in 0.03557 seconds