Re: Context Menu for GtkTreeView without losing the selection?

1. Connect your "button-press-event" signal handler "before" default gtk
2. Return TRUE from your callback when you decided that popup menu
should appear - this will prevent selection changing

To get menu at clicking on the header you should connect to
button-press-event for header widget. For default widget you could
get_button() for GtkTreeViewColumn, either pack your own widget and
connect signal handler to it.

В Пнд, 25/04/2011 в 15:03 +0700, Lothar Scholz пишет:
> Hello Gtk-list,
> I want to add a context menu on a tree in multiple selection mode.
> Using a signal handler like this:
> g_signal_connect(G_OBJECT(widget), "button_release_event", G_CALLBACK(context_menu_handler), view);
> and then showing the menu via gtk_menu_popup does unfortunately
> unselect all rows except the one under the mouse (on right mouse
> button press).
> How can i change this and offer a context menu for
> multiple items?
> Also how can i add a context menu on the column view header?
Andrew E. Makeev <andrew solvo ru>
Solvo Logistic

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]