Re: gtk 2.10 : GtkTreeView coords conversion
- From: Damien Carbonne <aetdcarbonne free fr>
- To: Kristian Rietveld <kris imendio com>
- Cc: gtk-list gnome org
- Subject: Re: gtk 2.10 : GtkTreeView coords conversion
- Date: Sun, 18 Nov 2007 23:32:11 +0100
Kristian Rietveld a écrit :
On Tue, Nov 13, 2007 at 09:58:15PM +0100, Damien Carbonne wrote:
My problem is the following:
I'm trying to convert mouse coordinates (x, y), obtained from a
button_press event,
into the clicked row by using gtk_tree_view_get_dest_row_at_pos.
I tried to use gtk_tree_view_widget_to_tree_coords to convert (x, y),
without success.
I noticed that there is a coord shift between (x, y) obtained from
button_press and the one obtained with DnD.
So my question is:
- Is there any practical solution, with gtk 2.10, to convert
button_event coords to be used
with gtk_tree_view_get_dest_row_at_pos ?
- Or do I have to wait for a GtkAda 2.12 binding ?
For handling button-press events, you want to:
1. Make sure the event is destined for the tree view's bin_window
by checking that
event->window == gtk_tree_view_get_bin_window (tree_view)
2. Then directly call gtk_tree_view_get_path_at_pos() with the
coordinates found in the event. No need to translate coordinates here.
It does not make much sense to use gtk_tree_view_get_dest_row_at_pos()
instead, since that function just calls gkt_tree_view_get_path_at_pos()
internally ;).
Hope this helps.
Thanks,
This worked.
I wanted to use the other function to create new nodes just
like DnD works (Into, Before, After, ...).
Looking into code of gtk_tree_view_get_dest_row_at_pos, I realized
there was a translation on Y axis using an internal macro (HEADER_...).
I have to think again to find the best way to create new nodes!
Thanks again
Damien
regards,
-kris.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]