Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / November 2007



Tip: Looking for answers? Try searching our database.

How to remove all submenu in hierachical multi-level menu (in menu bar)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mhz - 25 Nov 2007 16:50 GMT
Something like [NSPopUpButton removeAllItems] (but for menu bar item) ?

Or each submenu/item menu must be removed one each at time ?
How do this ?

Thank you.
David Phillip Oster - 25 Nov 2007 20:36 GMT
> Something like [NSPopUpButton removeAllItems] (but for menu bar item) ?
>
> Or each submenu/item menu must be removed one each at time ?
> How do this ?

The following works:

- (void)removeAllItemsOf:(NSMenu *)menu {
 int i, iCount = [menu numberOfItems];
 for (i = iCount - 1;0 <= i; --i) {
   [menu removeItemAtIndex:i];
 }
}
mhz - 26 Nov 2007 00:18 GMT
> > Something like [NSPopUpButton removeAllItems] (but for menu bar item) ?
> >
[quoted text clipped - 9 lines]
>   }
> }

But what happen to all submenus in these items. And all  items for these submenus. Etc..
Gregory Weston - 26 Nov 2007 12:00 GMT
> > > Something like [NSPopUpButton removeAllItems] (but for menu bar item) ?
> > >
[quoted text clipped - 12 lines]
> But what happen to all submenus in these items. And all  items for these
> submenus. Etc..

Unless your code is retaining them, they're gone.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.