Re: difference of the get_dest_row_at_pos and get_path_at_pos in treeview class



On Tue, 2007-10-02 at 20:45 +0100, Chris Vine wrote:
> On Tue, 2007-10-02 at 22:34 +0800, Liangxu Wang wrote:
> > Hi,
> > 	Sorry if I misunderstanding of these two function in treeview class,
> > from my understanding, the two function should get the path result, but
> > if I set the headers visible(this is the default behavior), the two
> > function return different path. So is this a bug or feature?
> > 	Thanks.
> > 
> > code example:
> > ++++++++++++++++++
> > 		Gtk::TreeModel::Path path;
> > 		Gtk::TreeViewColumn* c=0;
> > 		int cellx,celly;
> > 		get_path_at_pos(x,y,path,c,cellx,celly);
> > 		Gtk::TreeModel::iterator iter = refTreeModel->get_iter(path);
> > 		std::cout<<"x,y:"<<x<<","<<y<<std::endl;
> > 		if (iter)
> > 		{
> > 			std::cout<<(*iter)[columns.name]<<std::endl;
> > 		}
> > 		Gtk::TreeViewDropPosition 	 pos;
> > 		get_dest_row_at_pos(x,y,path,pos);
> > 		iter = refTreeModel->get_iter(path);
> > 		std::cout<<"x,y:"<<x<<","<<y<<std::endl;
> > 		if (iter)
> > 		{
> > 			std::cout<<(*iter)[columns.name]<<std::endl;
> 
> The GTK+ functions gtk_tree_view_get_dest_row_at_pos() takes widget
> co-ordinates, whereas gtk_tree_view_get_path_at_pos() takes GdkWindow
> (event) co-ordinates.  They will be different if your tree view has
> headers, as you have found.  If you want more information see
> file:///opt/gnome2/share/gtk-doc/html/gtk/GtkTreeView.html#gtk-tree-view-get-path-at-pos

Sorry, that's my internal documentation.   You need:
http://library.gnome.org/devel/gtk/unstable/GtkTreeView.html#gtk-tree-view-get-path-at-pos






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