add menu

  • Hi all:

    I created an NSMenu including several menu items in one NIB file (not
    MainMenu.nib) and would like to add it to [NSApp mainMenu]. However, I
    cannot find any method which would allow me to do something like:

        [[NSApp mainMenu] addMenu:theMenu
                        withTitle:@"New Menu"
                          atIndex:3];

    How can I load a complete menu entry with all menu items into the main
    menu?

    Thanks,
    /CA
  • I think you have to add it as a "submenu."

    Claus Atzenbeck wrote:
    > Hi all:
    >
    > I created an NSMenu including several menu items in one NIB file (not
    > MainMenu.nib) and would like to add it to [NSApp mainMenu]. However, I
    > cannot find any method which would allow me to do something like:
    >
    > [[NSApp mainMenu] addMenu:theMenu
    > withTitle:@"New Menu"
    > atIndex:3];
    >
    > How can I load a complete menu entry with all menu items into the main
    > menu?
    >
    > Thanks,
    > /CA
    >
  • Hey Claus -

    Menus are composed of menu items, and a menu item can have a sub-menu.
    So, if you want to load a menu into the main menu, you have to add a
    menu item to the main menu that has your menu as its submenu.

    Jon Hess

    On Dec 12, 2007, at 7:01 AM, Claus Atzenbeck wrote:

    > Hi all:
    >
    > I created an NSMenu including several menu items in one NIB file (not
    > MainMenu.nib) and would like to add it to [NSApp mainMenu]. However, I
    > cannot find any method which would allow me to do something like:
    >
    > [[NSApp mainMenu] addMenu:theMenu
    > withTitle:@"New Menu"
    > atIndex:3];
    >
    > How can I load a complete menu entry with all menu items into the main
    > menu?
    >
    > Thanks,
    > /CA
  • On Wed, 12 Dec 2007, Jonathan Hess wrote:

    > Menus are composed of menu items, and a menu item can have a sub-menu. So, if
    > you want to load a menu into the main menu, you have to add a menu item to the
    > main menu that has your menu as its submenu.

    I should have realized this myself. Thanks, also to John (separate
    e-mail).

    Cheers,
    Claus
previous month december 2007 next month
MTWTFSS
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
Go to today