[Gtk-sharp-list] Help with dynamically adding to a Menu - what am I doing wrong
alanb
alan.battersby at ntlworld.com
Mon Feb 22 16:04:39 EST 2010
My program uses Monodevelop.Dock and I want to add all open Dockitems to a
menu on the Mainwindow Menubar. So I created an action called WindowsAction
with the idea of adding all the labels of my Docked windows to this.
Ultimately I want to be able to open / close dock items by clicking on an
item in this list. The code I wrote is shown below but does not work,
nothing is added to the action.
void setWindowChoices()
{
Widget mnu = WindowsAction.CreateMenu();
foreach(DockItem di in df.GetItems())
{
MenuItem mnuitm = (MenuItem)WindowsAction.CreateMenuItem();
mnuitm.Name = di.Label;
mnuitm.Visible = true;
mnuitm.Sensitive = (di.Status == DockItemStatus.Dockable);
}
}
Because WindowsAction has no ShowAll or Show functionality I assumed that
CreateMenu() added and attached a menu to the Action and that everything I
added to that menu would be automatically shown. But that doesnt seem to be
the case so I would appreciate any help.
Thanks
Alan
--
View this message in context: http://n4.nabble.com/Help-with-dynamically-adding-to-a-Menu-what-am-I-doing-wrong-tp1565136p1565136.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.
More information about the Gtk-sharp-list
mailing list