discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Question about NSMenuView


From: Germán André Arias Santiago
Subject: Question about NSMenuView
Date: Sun, 11 Jan 2009 22:54:52 -0600

Hi, I want try to make a horizontal menu inside a window. But, I have a
problem. First I create an app with ProjectCenter, then in GORM delete
the menu, and add a window. Add a CustomView at the top of window, and
create a subclass of NSView (In GORM there isn't any NSMenuView class)
and set this class to the CustomView. Then, in ProjectCenter, I change
the class to inherits from NSMenuVIew. And add this code in the
awakeFromNib method

NSMenu *menu, *infoMenu;

menu = AUTORELEASE([NSMenu new]);

infoMenu = AUTORELEASE ([NSMenu new]);
[infoMenu addItemWithTitle: @"Info Panel..." 
          action: @selector (orderFrontStandardInfoPanel:) 
          keyEquivalent: @""];
[infoMenu addItemWithTitle: @"Help..." 
          action: @selector (orderFrontHelpPanel:)
          keyEquivalent: @"?"];
          
NSMenuItem *menuItem; 
menuItem = [menu addItemWithTitle: @"Info..." action: NULL
keyEquivalent: @""];
[menu setSubmenu: infoMenu forItem: menuItem] ;

[menu addItemWithTitle: @"Quit" action: @selector (terminate:)
keyEquivalent: @"q"]; 

[self setMenu: menu] ;
[self setHorizontal: YES] ;

At run the app, I see the menu, but when I do a clic in this the app
crash. If I delete the last two lines, and write [NSApp setMainMenu:
menu], the app work fine. In Mac dev center there isn't information
about this class (in fact is deprecated). Any suggestion?   





reply via email to

[Prev in Thread] Current Thread [Next in Thread]