[Gtk-sharp-list] popup menu (combobox?) for treeview?

danieru samuraidanieru at gmail.com
Thu May 21 18:10:14 EDT 2009


Greetings!
I'm trying to implement a popup menu for my treeview. From other threads
I've found out how to capture the mouse right-click event with
[Gtk.ConnectBeforeAttribute], so that's working ok. Now I'm unclear on how
to make the correct type of menu and have it popup. I had found instructions
in the Mono API documentation explaining how to use a menu class, add
menuitems, etc., but that was a dead-end since it's telling you to use the
obsolete OptionMenu. I then found another thread here saying to use a
ComboBox instead, but the docs don't mention anything about how to use a
ComboBox as a popup menu. I am seeing the Popup function, but can't seem to
get it to work. I'm trying this:

Gtk.ComboBox jBox = ComboBox.NewText();
				
jBox.AppendText("new job");
jBox.AppendText("edit job");
jBox.AppendText("remove job");
jBox.AppendText("remove finished jobs");
				
jobsView.Add(jBox);
jobsView.ShowAll();
jBox.Popup();

...I'm fairly new to Gtk so am not clear on if the Add and ShowAll functions
are necessary for a popup menu, or if I should be trying to make the menu a
child to the TreeView, or the main window? At any rate, I'm seeing nothing,
so don't quite know what to try next. My google searches all seem to be
dealing with the older menu approach...

Any help is appreciated, and thanks in advance!


-- 
View this message in context: http://www.nabble.com/popup-menu-%28combobox-%29-for-treeview--tp23660946p23660946.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list