Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsTable Column Width
https://www.eclipse.org/forums/index.php/mv/msg/147596/464580/#msg_464580
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]]>Martin2005-11-25T12:13:47-00:00Re: Table Column Width
https://www.eclipse.org/forums/index.php/mv/msg/147596/464584/#msg_464584
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
>]]>Veronika Irvine2005-11-25T14:24:09-00:00Re: Table Column Width
https://www.eclipse.org/forums/index.php/mv/msg/147596/464665/#msg_464665
Originally posted by: e.s.com
is there some way to "tell" the table to resize itself to fit the text
size or to adjust according to its parent composite?]]>2005-11-28T13:40:04-00:00Re: Table Column Width
https://www.eclipse.org/forums/index.php/mv/msg/147596/464670/#msg_464670
table.getShell().layout(new Control[] {table});
"Erel" <e@s.com> wrote in message
news:cb2d03eb4d6fc749f8a20fd9f43b503e$1@www.eclipse.org...
> is there some way to "tell" the table to resize itself to fit the text
> size or to adjust according to its parent composite?
>]]>Veronika Irvine2005-11-28T15:20:53-00:00Re: Table Column Width
https://www.eclipse.org/forums/index.php/mv/msg/147596/464873/#msg_464873
Is pack() supposed to work like this for tree columns as well?
When I call pack() it only sizes to the top level items, not the
indented / child ones. this is happening for all columns.
I'm on Linux/GTK if that matters.
thanks!
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
>>
>
>
>]]>Jeremy Dowdall2005-11-30T20:27:22-00:00Re: Table Column Width
https://www.eclipse.org/forums/index.php/mv/msg/147596/464875/#msg_464875
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
>>
>
>
>]]>Jeremy Dowdall2005-11-30T20:51:03-00:00Re: Table Column Width
https://www.eclipse.org/forums/index.php/mv/msg/147596/464945/#msg_464945
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.
"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
>]]>Veronika Irvine2005-12-01T16:14:21-00:00Re: Table Column Width
https://www.eclipse.org/forums/index.php/mv/msg/147596/464951/#msg_464951
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
>>
>
>]]>Jeremy Dowdall2005-12-01T17:17:46-00:00