Table Column Width [message #464580] |
Fri, 25 November 2005 07:13  |
Eclipse User |
|
|
|
Hi,
is there a way that the columns of a table are automatically resized
depending on the text that is in it's cells.
At the moment i use the work around to determine the average character
width from a GC and multiply it with the maximum number of characters in
this column, which i think is very messy (especially because it's only the
average character width, so i have to add at least 1 or 2 pixels per
character so that the column is really big enough)
Thanks
Martin
|
|
|
|
|
|
|
Re: Table Column Width [message #464875 is a reply to message #464584] |
Wed, 30 November 2005 15:51   |
Eclipse User |
|
|
|
I could be way off, but what the heck! :)
in TreeColumn's Pack routine:
int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
if (OS.gtk_tree_model_get_iter_first (parent.modelHandle, iter)) {
do {
width = Math.max (width, parent.calculateWidth (handle, iter));
} while (OS.gtk_tree_model_iter_next(parent.modelHandle, iter));
}
OS.g_free (iter);
seems that it needs to tunnel down through all the children here, as
it's currently just getting the direct children of the parent tree
Veronika Irvine wrote:
> TableColumn.pack() will size the column to be as wide as its widest item.
> It is not "automatic" in that you have to call it each time you change the
> text or image for a TableItem.
>
> "Martin" <xx@xx.com> wrote in message
> news:45ad0f30aa23f90ce161d177632a7834$1@www.eclipse.org...
>
>>Hi,
>>is there a way that the columns of a table are automatically resized
>>depending on the text that is in it's cells. At the moment i use the work
>>around to determine the average character width from a GC and multiply it
>>with the maximum number of characters in this column, which i think is
>>very messy (especially because it's only the average character width, so i
>>have to add at least 1 or 2 pixels per character so that the column is
>>really big enough)
>>
>>Thanks
>>Martin
>>
>
>
>
|
|
|
|
Re: Table Column Width [message #464951 is a reply to message #464945] |
Thu, 01 December 2005 12:17  |
Eclipse User |
|
|
|
thanks Veronika, I definitely agree that it doesn't make sense to size
the non-expanded (and thus non-visible) items! :)
any suggestions as to a short term work-around? It doesn't seem that I
can access any size info on a per column per item basis...
Veronika Irvine wrote:
> We have had some discussion in the past on our team about this.
>
> The problem is that if you have a TreeItem with subitems with subitems with
> subitems with subitem with subitems ..
>
> For each subitem there is some indentation. When you pack the column, if
> you include all children (expanded or not) the column could become very wide
> just to accomodate this indententation for sublevels even though the
> unexpanded children are not visible.
>
> Personally I think pack on a TreeColumn should make the column as wide as
> the widest expanded child. I have entered the following bug report:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=118844
>
> "Jeremy Dowdall" <dev@myriadfinancial.com> wrote in message
> news:dml3bk$qea$1@news.eclipse.org...
>
>>I could be way off, but what the heck! :)
>>
>>in TreeColumn's Pack routine:
>>
>>int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
>>if (OS.gtk_tree_model_get_iter_first (parent.modelHandle, iter)) {
>> do {
>> width = Math.max (width, parent.calculateWidth (handle, iter));
>> } while (OS.gtk_tree_model_iter_next(parent.modelHandle, iter));
>>}
>>OS.g_free (iter);
>>
>>
>>seems that it needs to tunnel down through all the children here, as it's
>>currently just getting the direct children of the parent tree
>>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05250 seconds