[Gtk-sharp-list] Context Menu On A TreeView Row
Adam Tauno Williams
Wed, 29 Sep 2004 07:59:18 -0400
I am trying to build a popup menu attached to a click or popup event
(Shift F10) on items in a treeview. Does anyone have a Gtk#/C# example
for doing this? I've tried translating from an example in C but
apparently I've missed something.
1.) The ButtonPressEvent doesn't get fired when a row is clicked on,
although the row does become 'highlighted' normally.
2.) The PopUp event does fire, but no menu appears.
teamTreeView = new TreeView();
teamTreeView.PopupMenu += on_tree_popup_menu;
teamTreeView.ButtonPressEvent += on_tree_button_press;
public void on_tree_popup_menu(object o, PopupMenuArgs args)
public void on_tree_button_press(object o, ButtonPressEventArgs args)
if (args.Event.Button == 3)
protected void DoPopUp()
Menu popup = new Menu();
popup.Popup(null, null, null, IntPtr.Zero, 3,