How to get the coordinates of a GtkTreeView row

走远了吗. 提交于 2019-12-13 03:08:50

问题


I'm using a GtkTreeView widget. If I have a row's GtkTreeIter, how can I then get that row's current position (vertical pixel coordinate) within the entire GtkTreeView window?

My underlying problem is that I need to get a GtkTreeIter for whatever row is currently placed at a given vertical coordinate relative to the entire GtkTreeView window, but I don't know how.

Any help would be greatly appreciated!! Thanks in advance :-)


回答1:


This function:

gtk_tree_view_get_path_at_pos (GtkTreeView        *tree_view,
                               gint                x,
                               gint                y,
                               GtkTreePath       **path,
                               GtkTreeViewColumn **column,
                               gint               *cell_x,
                               gint               *cell_y)

will give you a path that you can pass to

gtk_tree_model_get_iter()

to get an iterator.



来源:https://stackoverflow.com/questions/14838195/how-to-get-the-coordinates-of-a-gtktreeview-row

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!