Re: GtkTreeview::get_path_at_pos() possible bug?
| From: | kksou | Date: | Tue, 13 Feb 2007 09:56:05 +0000 |
| Subject: | Re: GtkTreeview::get_path_at_pos() possible bug? | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-7684@lists.php.net to get a copy of this message | ||
André Jansen wrote:
> In my experience however the drop destination sometimes was one row off,
> sometimes two, making the result rather unpredictable. Looking at the (x,
> y) coordinates returned by the drop event, I concluded that the y
> coordinate included the height of the column header, and
> get_path_at_pos() *doesn't know this*. Turning off the column headers, or
> subtracting the header height from the y coordinate, cured the problem.
>
> If one does want headers however, that would involve hard coding the
> header height since there is no way I know off to get the actual header
> height - which depends on things like character height and might vary
> between systems...
>
> André
>
If you can forgo the sorting of columns (when you click on the header), you
can turn the sorting off for the treeview columns. And you will find that
the signal motion-notify-event will not be generated when the mouse is in
the header region. This will allow you to get the correct readings for
get_path_at_pos().
You can find a sample code here:
http://www.kksou.com/php-gtk2/articles/display-tooltips-in-GtkTreeView---Part-3---no-hardcoding-of-header-height.php
As you can see from the sample output below, I have used an extra large font
to show that no hardcoding is required for the height of the header. It
works on both windows and linux.
http://www.kksou.com/php-gtk2/gif/0168.gif
Regards,
/kksou
--
View this message in context: http://www.nabble.com/GtkTreeview%3A%3Aget_path_at_pos%28%29-possible-bug--tf3209784.html#a8941341
Sent from the Php - GTK - General mailing list archive at Nabble.com.