tree view column sizing problem

2007-08-28 Thread Allin Cottrell
I have a tree view with 3 columns, which sits within a scrolled 
window.  

The middle column contains what can be quite a lengthy string. 
When the user opens the window in question, I'd like her to be 
visually aware that the third column is there: the problem is that 
with the columns autosized, the length of the middle string can 
push the third column out of the visible zone (you have to scroll 
horizontally to reach it).

The ideal solution, I think, would be (a) set the starting width 
of the middle column to some reasonable maximum (when the window 
is first opened), but then (b) allow the user to expand it to read 
the full string if need be.

I can achieve (a) using gtk_tree_view_column_set_max_width() with 
a suitable second argument, but how to achieve (b)?  I have tried 
calling gtk_tree_view_column_set_max_width() with a second 
argument of -1 once the tree view is realized, but this results in 
the column immediately being autosized, making (a) useless.

I guess what I'm looking for is

 gtk_tree_view_column_set_width()

without the "max".  That function doesn't exist, but is there a 
way of doing it?  Thanks for any suggestions.

-- 
Allin Cottrell
Department of Economics
Wake Forest University, NC
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: tree view column sizing problem

2007-08-28 Thread Dave Howorth
Allin Cottrell wrote:
> I have a tree view with 3 columns, which sits within a scrolled 
> window.  
> 
> The middle column contains what can be quite a lengthy string. 
> When the user opens the window in question, I'd like her to be 
> visually aware that the third column is there: the problem is that 
> with the columns autosized, the length of the middle string can 
> push the third column out of the visible zone (you have to scroll 
> horizontally to reach it).

I presume you can't just swap the second and third columns?

> The ideal solution, I think, would be (a) set the starting width 
> of the middle column to some reasonable maximum (when the window 
> is first opened), but then (b) allow the user to expand it to read 
> the full string if need be.

If the user can be satisfied with seeing one complete string at a time,
another option is to add a full-width label widget at the bottom of the
window showing the content of the second column of the currently
selected row. That avoids the need for the user to resize anything.

Or add tooltips to the column.

Cheers, Dave
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: tree view column sizing problem

2007-08-28 Thread Allin Cottrell
On Tue, 28 Aug 2007, Dave Howorth wrote:

> Allin Cottrell wrote:
> > I have a tree view with 3 columns, which sits within a scrolled 
> > window.  
> > 
> > The middle column contains what can be quite a lengthy string. 
> > When the user opens the window in question, I'd like her to be 
> > visually aware that the third column is there: the problem is that 
> > with the columns autosized, the length of the middle string can 
> > push the third column out of the visible zone (you have to scroll 
> > horizontally to reach it).
> 
> I presume you can't just swap the second and third columns?

Thet crossed my mind, but it's not ideal.  The third column 
contains what's in a sense secondary information.

> > The ideal solution, I think, would be (a) set the starting width 
> > of the middle column to some reasonable maximum (when the window 
> > is first opened), but then (b) allow the user to expand it to read 
> > the full string if need be.
> 
> If the user can be satisfied with seeing one complete string at a time,
> another option is to add a full-width label widget at the bottom of the
> window showing the content of the second column of the currently
> selected row. That avoids the need for the user to resize anything.
> 
> Or add tooltips to the column.

Thanks, tooltips might be a good way to go -- though it looks as 
if adding tips to a treeview cell is not trivial!

Allin Cottrell
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: tree view column sizing problem

2007-08-28 Thread Allin Cottrell
Just for the record, if anyone else hits this.

> I wrote:
> > I have a tree view with 3 columns, which sits within a scrolled 
> > window.  
> > 
> > The middle column contains what can be quite a lengthy string. 
> > When the user opens the window in question, I'd like her to be 
> > visually aware that the third column is there: the problem is that 
> > with the columns autosized, the length of the middle string can 
> > push the third column out of the visible zone (you have to scroll 
> > horizontally to reach it).
> 
> > The ideal solution, I think, would be (a) set the starting width 
> > of the middle column to some reasonable maximum (when the window 
> > is first opened), but then (b) allow the user to expand it to read 
> > the full string if need be.

Dave Howorth responded:

> If the user can be satisfied with seeing one complete string at a time,
> another option is to add a full-width label widget at the bottom of the
> window showing the content of the second column of the currently
> selected row. That avoids the need for the user to resize anything.
> 
> Or add tooltips to the column.

I tried tooltips (well, a hand-rolled tooltip using gtk_window, 
since the current gtk tooltips API doesn't work with treeview 
cells), but it was a lot of work, and didn't really cut it.  

For example, if the user maximizes the window on a big screen, we 
_really_ don't want to artificially restrict the width of the big 
second column, and only show its full content via an auxiliary 
popup.

My solution: check the widths in the process of creating the 
window.  If the middle column is going to push the third column 
into the non-visible zone, restrict its width with 
gtk_tree_view_column_set_max_width().  But also -- and this makes 
the whole thing work -- add a callback to motion-notify-event for 
the treeview: 

static gboolean 
big_col_callback (GtkWidget *w, 
 GdkEventMotion *e, 
 gpointer p)
{
GtkTreeViewColumn *col = 
gtk_tree_view_get_column(GTK_TREE_VIEW(w), 1);

if (gtk_tree_view_column_get_max_width(col) > 0) {
/* remove the width constraint */
gtk_tree_view_column_set_max_width(col, -1);
}

return FALSE;
}

The effect is that column 1 starts at a size that allows the third 
column to be visible, but as soon as the user moves the mouse in 
the treeview window, the column becomes freely resizable.

Allin Cottrell

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


reduce flicker while resizing columns of GtkTreeView on Windows

2007-08-28 Thread Abirami.T

hi all,
While trying to resize the GtkTreeView Columns on Windows Operating 
System,
the text (label) in the column header seems to flicker (as the background of
the treeview is visible.)
This does not happen on Linux. What needs to be done to reduce this flicker
so that the resize appears to be smooth?


Thanks in advance,
Abirami.



The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments contained in it.

Contact your Administrator for further information.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list