[Gtk-sharp-list] Problem Creating Dropdown Menu When Activating a Menu Action

Jim Orcheson jim at va3hj.ca
Wed Jun 8 14:34:50 EDT 2011

I have created a menu on a menubar using stetic within Monodevelop, and 
want to generate the menu items to be displayed when the menu is 
activated. Here is the code I have for the method:

         protected virtual void OnSelectActionActivated (object sender, 
System.EventArgs e)
             Gtk.Action act = sender as Gtk.Action;
             // get menu item associated with the drop-down menu
             Widget[] w = act.Proxies;
             MenuItem mi = w[0] as MenuItem;
             // get the dropdown menu
             Menu menu = mi.Submenu as Menu;
             // delete the menu items already in the menu
             foreach(Widget wid in menu.Children)
             // create new menuitem
             MenuItem miB = new MenuItem("Background");
             // add to menu

When I click on the menu, this code is activated but no dropdown menu 
appears. If I look at the number of menu items in the menu before 
destroying the widgets, there are two the first time through (a 
TearOffMenuItem and a MenuItem which displays "Empty") and one each 
additional time through method.

What am I missing?

More information about the Gtk-sharp-list mailing list