作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想在两个 TOPLEVEL GtkWindow 之间进行通信。 例如,我双击GtkTreeView中的行,新的GtkWindow用于修改该行的上下文。 但是,除了声明一个全局变量来传递结构体之外,我没有找到解决方案。我是否可以找到一个巧妙的方法来帮助我解决问题? 作为 GTK 的新手,我将感谢您的帮助。
最佳答案
您可以通过“行激活”信号传递数据:
this_window = gtk_window_new (mode);
that_window = gtk_window_new (mode);
tv = gtk_tree_view_new ();
g_object_connect (tv, "row_activated",
G_CALLBACK (on_row_activate), that_window);
static mode my_func_using_data (view, that_window)
{
// do something here to pass a data to view
....
....
selection = view.get_selection ()
GtkTreeModel *model;
GtkTreeIter iter;
if ( gtk_tree_selection_get_selected (selection))
{
// modify the data here with model and iter
}
}
static void on_row_activate (GtkTreeView *view,
GtkTreePath *path,
GtkTreeViewColumn *col,
gpointer that_window)
{
my_func_using_data (view, that_window)
}
关于c - GTK+ :How to communicating between GtkWindow?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24720462/
我是一名优秀的程序员,十分优秀!