Re: Tooltips only work on top half of a GtkTreeView



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 <nigel stuckey systemgarden com> 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
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]