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