Access to main app menu

mksoft_

Registered
I want to add lines and modify the 'main app menu', the one bold with the name of the app

(see screenshot :) )

Is it a way? i've spend hours without finding anything...

I work with XCode 2.4, Objective-C and Cocoa, i don't use at all interface builder nor nib files

Thanks a lot !
 

Attachments

  • menu.jpg
    menu.jpg
    62.2 KB · Views: 17
I don't understand why you wouldn't use Interface Builder and nib files if you're writing Cocoa applications. Interface Builder is one of the reasons why writing Cocoa applications is easier than writing applications with other frameworks. You can easily add an item to the application menu in Interface Builder. Drag a menu item to the application menu.

If you're still determined to add a menu item in code, look at the NSMenuItem and NSMenu documentation. The initWithTitle method in the NSMenuItem class creates a menu item, and the addItem method in the NSMenu class adds the newly created item to a menu.
 
i create a software which run on both mac and windows, that's the reason

i know how to add a menu and items into menus, i want to add items into the application menu (the one in bold font with the name of the software, as you can see on the screenshot)
i can't find any information about how to access this menu...
 
Resolved: it seems on tiger the [NSApp setAppleMenu:] method disappeared, but it's possible to 'put it back' with :

@interface NSApplication(AppleMenu)
-(void)setAppleMenu:(NSMenu*)menu;
@end

Don't know why we have to do this, there is no documentation about it anywhere on apple website...
Anybody know the reason of this?
 
Back
Top