cocoa - NSMenuDelegate questions -
I have an NSMenu that has a static and dynamically created NSMenuItem (fixed meaning NSMenuItem interface built in builder, dynamic meaning is built on NSMenuItem run- Time). Although I'm developing at 10.6, my application also provides 10.5 support.
There are many dynamic NSMenuItem in my menu that contain submenus
Edit: Here is a rigorous effort to create, currently, I have NSMenuItem The parentItem: method is unique to (10.6) when a submenu item is clicked.
A manual parent item: method, but it is not particularly comfortable, is definitely a better way?
- (NSMenuItem *) findParentByChild: (NSMenuItem *) For Children {int (x; x; x & lt; [statusBarMenu numberOfItems]; x ++) {// Avoid any Fixed item menu items if ([[statusBarMenu itemAtIndex: x] tag] = 100) {NSMenu * submenu = [[statusBarMenu itemAtIndex: x] Submenu]; If (submenu! = Zero) {for (int y = 0; y & lt; [submenu numberOfItems]; y ++) {// it looks like our parent if ([submenu items atindexx: y] == children ) {Return [StatusBarermanEightandx: X]; }}}}} Return zero; }
What is the best way to get 10.5 and 10.6 compatible in this way?
You have been saved: available since 10.3. : -)
Available in Mac OS X v10.3 and later. Mac OS X v10.6 is available as part of an informal protocol.
I use it heavily in an app that targets 10.5 / 10.6.
Note: This is related to the pre-queries related to the availability of answer-menuuedsUpdate:
Comments
Post a Comment