本文介绍了如何获取GtkTreeView行的坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用GtkTreeView小部件.如果我有一行的GtkTreeIter,那么如何在整个GtkTreeView窗口中获取该行的当前位置(垂直像素坐标)?

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?

我的潜在问题是,我需要针对相对于整个GtkTreeView窗口当前位于给定垂直坐标处的任何行获取一个GtkTreeIter,但我不知道如何.

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 :-)

推荐答案

此功能:

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()

获得一个迭代器.

这篇关于如何获取GtkTreeView行的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 11:32