Re: tooltip on treeview cell

Yoann Padioleau <[email protected]>
Newsgroups gmane.comp.lang.ocaml.lib.gtk
Message-ID <[email protected]>
Julien Moutinho <[email protected]> writes:

> On Thu, Feb 14, 2008 at 06:57:38PM -0600, Yoann Padioleau wrote:
>> Hi,
> Hi,
>
>> How can I set the tooltip for a cell in a treeview ?
>> Apparently the other gtk bindings offer a method
>> set_tooltip_tree_cell() but I didn't find it in
>> lablgtk.
>
> AFAIK, if you use a GTK+ whose version is lower than 2.12,
> then its tooltip machinery, GtkTooltips (note the 's'),
> does not handle treeview tooltips.
> So the usual way is to do it manually, that is, to hook
> a motion_notify callback to the treeview, which will call
> a get_path_at_pos to retrieve the treeview cell under the cursor,
> whose data is then used to hide/show a popup window actually
> being the tooltip.


Is there some (ocaml) code somewhere that does exactly this ? 

>
> However GTK+ 2.12 came up with a new tooltip machinery,
> GtkTooltip (no 's' now), which is way more powerful
> and handles treeview tooltips:
>   http://mail.gnome.org/archives/gtk-devel-list/2007-June/msg00092.html
>
> A few months ago, I've wrapped GtkTooltip into the SVN of LablGTK:
>   http://svn.gna.org/viewcvs/lablgtk/trunk
> One example for doing what you want with it being there:
>   http://svn.gna.org/viewcvs/lablgtk/trunk/examples/tooltip.ml?rev=1392

I get this when I try to compile tooltip.ml from 
the lablgtk subversion repository:

$ ocamlc -c -I ../src/ tooltip.ml
File "tooltip.ml", line 66, characters 1-12:
This expression has type GObj.misc_ops
It has no method set_tooltip_text

Do I also need a special version of lablgtk ? 

>
> However this wrap segfaults on my Debian box if the following
> patch against GTK+2.12 is not applied :
>   http://bugzilla.gnome.org/show_bug.cgi?id=478519
> I'm joining to this mail the patch updated to GTK+ 2.12.6.


>
> Feel free to tell GTK+'s developers your concern about BR#478519.
>
> HTH.
>
>
> --- gtk/gtktooltip.c.orig	2008-01-29 04:35:47.000000000 +0100
> +++ gtk/gtktooltip.c	2008-02-15 16:28:46.000000000 +0100
> @@ -862,6 +862,9 @@
>    tooltip = g_object_get_data (G_OBJECT (display),
>  			       "gdk-display-current-tooltip");
>  
> +  if (!tooltip)
> +    return;
> +
>    if (tooltip->keyboard_mode_enabled)
>      {
>        pointer_widget = tooltip_widget = tooltip->keyboard_widget;
> @@ -886,8 +889,6 @@
>  
>    g_object_get (tooltip_widget, "has-tooltip", &has_tooltip, NULL);
>  
> -  g_assert (tooltip != NULL);
> -
>    return_value = gtk_tooltip_run_requery (&tooltip_widget, tooltip, &x, &y);
>    if (!return_value)
>      return;
> @@ -994,7 +995,8 @@
>  
>    tooltip = g_object_get_data (G_OBJECT (display),
>  			       "gdk-display-current-tooltip");
> -  tooltip->timeout_id = 0;
> +  if (tooltip)
> +    tooltip->timeout_id = 0;
>  
>    return FALSE;
>  }
> @@ -1009,7 +1011,7 @@
>    tooltip = g_object_get_data (G_OBJECT (display),
>  			       "gdk-display-current-tooltip");
>  
> -  if (tooltip && GTK_TOOLTIP_VISIBLE (tooltip))
> +  if (!tooltip || GTK_TOOLTIP_VISIBLE (tooltip))
>      return;
>  
>    if (tooltip->timeout_id)
> _______________________________________________
> Lablgtk mailing list
> [email protected]
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/lablgtk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.