Re: GtkTreeView menu popup
- From: Emmanuele Bassi <bassi-e libero it>
- To: gtk-app-devel-list gnome org
- Subject: Re: GtkTreeView menu popup
- Date: Fri, 31 Jan 2003 17:50:12 +0100
* tom <tom dbservice com>:
Hi,
how can i add a popup menu to a treeview ?
so when the user presses the right mouse button, the menu appears ?
Add a callback for the 'button_press_event' signal of the TreeView
widget, using:
g_signal_connect (G_OBJECT(treeview),
"button-press-event",
G_CALLBACK(popup_menu_cb), NULL);
Where popup_menu_cb is a callback in the form:
gboolean
popup_menu_cb (GtkWidget *widget,
GdkEventButton *event,
gpointer user_data);
In order to catch the right click, you must check that event.button
is == 3.
Once you're inside the callback, just create a Gtk::Menu widget, pack
all the Gtk::MenuItems, and show it using gtk_menu_popup().
Hope this helps,
Emmanuele.
--
Emmanuele Bassi (Zefram) [ http://digilander.iol.it/ebassi/ ]
GnuPG Key fingerprint = 4DD0 C90D 4070 F071 5738 08BD 8ECC DB8F A432 0FF4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]