Re: gtk 2.10 : GtkTreeView coords conversion

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

 



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.


regards,

-kris.
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux