c: GtkListStore 行更改事件 - 我如何获取所选行的数据?
你好,我使用 Glade 编写一个小型 gtk 应用程序。 该应用程序包括一个列表存储。每当用户单击一行时,我希望能够获取该行包含的信息。
在行更改事件下使用空地,我添加了以下功能:
void gtk_tree_view_row_activated_event_handler(GtkWidget *widget, gpointer data) {
GtkTreeSelection *selection;
GList *rows_list;
selection = gtk_tree_view_get_selection(widget);
rows_list = gtk_tree_selection_get_selected_rows (selection, widget);
}
如何从这里继续?
Hello I use glade to write a small gtk application.
the application includes a list store. and whenever a user clicks on a row, i want to be able to fetch the information that this row contains.
using glade under row-changed event i added the following function:
void gtk_tree_view_row_activated_event_handler(GtkWidget *widget, gpointer data) {
GtkTreeSelection *selection;
GList *rows_list;
selection = gtk_tree_view_get_selection(widget);
rows_list = gtk_tree_selection_get_selected_rows (selection, widget);
}
how do i continue from here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请检查下面的代码是否适合您:
我想实现您想要做的事情的另一种方法是定义 GtkTreeSelection 已更改 信号。下面是一个小例子:
设置树视图:
更改信号处理程序:
希望这有帮助,问候
pls, check if the code below would work for you:
I guess another way to achieve what you're trying to do would be defining a handler to the GtkTreeSelection changed signal. Below is a small example:
setting up tree view:
changed signal handler:
hope this helps, regards