Re: gtk 2.10 : GtkTreeView coords conversion
- From: Kristian Rietveld <kris imendio com>
- To: Damien Carbonne <aetdcarbonne free fr>
- Cc: gtk-list gnome org
- Subject: Re: gtk 2.10 : GtkTreeView coords conversion
- Date: Thu, 15 Nov 2007 12:36:25 +0100
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.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]