该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
gboolean onButtonPressed(
GtkWidget *widget,
GdkEventButton *event,
gpointer userdata) {
GtkTreeModel *model;
GtkTreeIter iter;
GtkTreePath *path;
GtkTreePath *cousor_path;
GtkTreeViewColumn *col;
gint x,y;
gint cell_x, cell_y;
if (event->button == 1)
return FALSE;
if (event->button == 2)
return TRUE;
if (event->button == 3) {
if (event->type == GDK_BUTTON_PRESS) {
GdkEventButton *bevent = (GdkEventButton *)event;
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
bevent->button, bevent->time);
x = (gint)event->x;
y = (gint)event->y;
gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(treeview),
x, y, &path, &col, &cell_x, &cell_y);
gtk_widget_grab_focus(treeview);
gtk_tree_view_set_cursor(GTK_TREE_VIEW(treeview),
path, NULL, FALSE);
gtk_tree_path_free(path);
return TRUE;
}
}
return FALSE;
}
十一人真多呀,好不容易到家了。
看了一下API手册,总算把这个选中行搞定了。
现在就是弹出的菜单我怎么给弹出的菜单绑定事件,是什么事件?- -
我试了一下给menuitem绑定clicked事件,可是果断的没用。