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

Re: How to set a tool tip on a gtk_tree_store ?



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kristian Rietveld wrote:
> On Mon, May 11, 2009 at 6:55 PM, Gregory Hosler <ghosler redhat com> wrote:
>> The problem I'm facing is getting the GtkTooltip of a cell of the GtkTreeStore.
> 
> You should keep in mind that tooltips operate on GtkWidgets

This I was aware of.

> a GtkTreeStore is not a widget.

This I wasn't aware of.

> Instead you use the widget GtkTreeView
> which displays the GtkTreeStore for you.

This I kinda guessed to be the case.

>> I have read on gtk_tree_view_set_tooltip_cell(), but this requires me to
>> identify the GtkTreePath (to identify the row) and GtkTreeViewColumn (to
>> identify the column), and set the GtkTooltip. Again, I need a GtkTooltip.
>>
>> The GtkTooltip doesn't appear to have a "new" function, and only appears to be
>> obtainable by setting the "has-tooltip" (which I would want to set on the cell),
>> and then the invoked callback from the "query-tooltip" signal. The problem is
>> that the private data will be different for each individual cell which has a
>> tool tip.
> 
> GtkTooltip objects are always obtained in a query-tooltip callback,
> you do not create them yourself.
> 
> The workflow for tooltips on tree views is basically:
> 1. Set has-tooltip to TRUE on the tree view widget and install a
> query-tooltip signal handler.
> 2. In the signal handler you obtain the path and column/cell from the
> given (x, y) coordinates.
> 3. Decide whether or not you want to display a tooltip for these coordinates.
> 
> See
> 
> http://git.gnome.org/cgit/gtk+/tree/tests/testtooltips.c

ok. that helps a lot. Your "workflow" pretty much jives with the documentation I
found. What was missing was an example. :)

Thanks a lot, and all the best,

- -Greg

> for a brief example.  (It uses gtk_tree_view_set_tooltip_row() though,
> but it should get the point across and you'll then understand how to
> substitute the usage of gtk_tree_view_set_tooltip_row() with
> gtk_tree_view_set_tooltip_cell()).
> 
> 
> regards,
> 
> -kris.


- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   ghosler redhat com    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkoIbpYACgkQ404fl/0CV/RjagCePXlf3pYVx1DPIByQJfaRcCn7
iAcAoNOYlIRA+fFfZRpbUlZWTW84Yxld
=HAcX
-----END PGP SIGNATURE-----


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