Ian

Many thanks for the suggestion.  I swapped the functions round and found that 
it worked for every row when the list was not scrolled horizontally. However, 
when I did scroll to the right, the tooltip x-axis alignment did not correspond 
to the columns. In fact it appeared to approximately double the effect of 
moving to the right and halfway through the horizontal scroll, it was out of 
range.

The list is packed as...  GtkScrolledWindow->GtkTreeView

Any ideas?

Nigel

On 2 May 2011, at 14:10, Ian Liu Rodrigues wrote:

> I guess the function to transform the X, Y coordinates is wrong. Try changing
> 
> gtk_tree_view_convert_bin_window_to_tree_coords to 
> gtk_tree_view_convert_widget_to_bin_window_coords
> 
> Ian L.
> 
> On Fri, Apr 29, 2011 at 12:08 PM, Nigel Stuckey 
> <[email protected]> wrote:
> I'm about to launch a Gtk2/3 version of a data collector/viewer and 
> performance monitor, a port from a Gtk1 app made a number of years ago.
> 
> I've got a number of problems outstanding with the GUI part that I would like 
> some help with and possibly some advice with some horrid code!
> 
> My first problem: I have tooltips in a tabular view of data, contained in a 
> GtkTreeView with a GtkListStore as model, which can grow to be quite big. 
> Unfortunately, the tooltips are only successfully produced in the top half of 
> the GtkTreeView. The lower half doesn't work -- the effect being proportional 
> to the size of the list rather than an absolute numeric limit.
> 
> The code is:-
> 
>     /* get the tooltip details */
>     if (!gtk_tree_view_get_tooltip_context (tree_view, &x, &y,
>                                             keyboard_tip,
>                                             &model, &path, &iter))
>          return FALSE;
> 
>     /* find time data and the row number (path) */
>     gtk_tree_model_get (model, &iter, uitable_timecol, &samptime, -1);
>     pathstring = gtk_tree_path_to_string (path);
> 
>     /* find the column tooltip - if keyboard_tip==FALSE, then (x,y) are
>      * converted to bin_window coords; else treat as a widget coords.
>      * We want tree coords. */
>     if (keyboard_tip)
>          gtk_tree_view_convert_widget_to_tree_coords(tree_view, x, y,
>                                                      &treex, &treey);
>     else
>          gtk_tree_view_convert_bin_window_to_tree_coords(tree_view, x, y,
>                                                          &treex, &treey);
> 
>     /* get the column, so I can get the title and the tip */
>     if (gtk_tree_view_get_path_at_pos(tree_view, treex, treey, NULL,
>                                       &column, NULL, NULL)) {
> 
>          /* valid row, compose tooltip string in tip (snip, snip) */
> 
>          g_object_get (column->button, "tooltip-text", &tip, NULL); /* A */
>     } else {
>          g_snprintf (buffer, 511, "Row does not exist (path %s)", 
> pathstring); /* B */
>     }
> 
> Following the call to gtk_tree_view_get_path_at_pos(), the first set of rows 
> runs code path A and I get the tooltip I want, the bottom half runs B and I 
> report an error.
> 
> Can anyone help shed some light on this?
> 
> Many thanks
> 
> Nigel
> 
> _______________________________________________
> gtk-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gtk-list
> 

--
Nigel Stuckey
System Garden Ltd
www.systemgarden.com
+44 (0)7710 439986
+44 (0)20 7100 6627





_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to