[Gtk-sharp-list] How to remove menuitems from a menu

Davide Lasagna lasagnadavide at gmail.com
Wed Apr 14 15:27:50 EDT 2010

I'm quite new to gtksharp. I have a menu which i want to update in response
of some event.
The first 6 items must always remain there, then i have to append some
menuitems which
change at each call to this method.

Here is the code that i have at the moment.

The variable gomenu is the menu to be modified.

void UpdateGoToHistoryMenu()

// first i need to uderstand how to remove the previously added menuitems
                        // because otherwise i will continue to add
                        // Here i want to remove the menuitems from 7 to
end. How do i do this?
 // then i can add elements
System.Collections.Generic.List<string> hist = history.GetElements();
for ( int i=0; i < hist.Count - 1; i++ )
ImageMenuItem item = new ImageMenuItem( hist[i] ){
Image = new Image(Stock.Directory, IconSize.Menu )};
gomenu.Insert(item, 6);
Basically i want to remove the menuitems from index 6 to the end of the


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20100414/936cf079/attachment-0001.html 

More information about the Gtk-sharp-list mailing list