ColumnWidth for setFillLayout(true) column [message #12661] |
Fri, 29 September 2006 09:45  |
Eclipse User |
|
|
|
>I'm admittedly a little confused here - would you be able to post the
>code for your cell?
>thanks!
I've just picked this back up again and I think I see where the problem is.
I have a tableTree of expandable composites. The tableTree has 1 column,
which is also the treeColumn. The column is set to fill the view
horizontally with column.setFillLayout(true). I have some prebuilt nodes
that I add to my tableTree on startup (i.e.
ContentProvider.setInput(prebuiltNodes)).
The CContainerLayout.computeHeaderSize(...) seems to the point where
columnWidths are initialized with iterated calls to column.getWidth().
During startup, the getWidth() call returns 0 (reminder that column
isAutoWidth. I've put in a default width in my parseStr so that I'm not
operating with 0 widths). On initial display therefore, line breaks are
all based on the default width regardless of what the column width
actually is. When I perform some action on the node (expand, add a child
node) that forces a call to update(..), columnWidths appear to have proper
values and the cell is redisplayed with appropriate line width breaks.
Trying to find out at what point the columnWidths are actually set to
proper widths.
I'm adding the update method here but it doesnt appear to be the issue.
parseStr(...) just uses a TextLayout to break str into lines according the
columnWidth measurement.
public boolean update(Object element, String[] properties)
{ if(update && element instanceof Node)
{ String str = ((Node) element).getCaption();
int[] lines = parseStr(str);
if(lines != null)
{ String formattedStr = format(str, lines, SWT.DEFAULT);
if(lines.length <= 2 || !((Node) element).hasChildren())
{ setText(formattedStr); }
else
setText(format(str, lines, 2));
if (text != null)
text.setText(formattedStr);
}
}
return false;
}
|
|
|
|
May be parent sash form problem.. [message #12704 is a reply to message #12683] |
Fri, 29 September 2006 11:35  |
Eclipse User |
|
|
|
The tableTree is a child in a two-part sashform. The weights for the
sashForm are set after the sashForm children are created.
The columnWidths might not be set until the sashForm resize is called,
which is after the tableTree Nodes have actually been formatted with
default width...
|
|
|
|
May be parent sash form problem.. [message #565800 is a reply to message #12683] |
Fri, 29 September 2006 11:35  |
Eclipse User |
|
|
|
The tableTree is a child in a two-part sashform. The weights for the
sashForm are set after the sashForm children are created.
The columnWidths might not be set until the sashForm resize is called,
which is after the tableTree Nodes have actually been formatted with
default width...
|
|
|
Powered by
FUDForum. Page generated in 0.03937 seconds