PDA

View Full Version : Adding sub menu to Main menu in Cocoa




xmax
Jun 1, 2009, 12:43 AM
Hello,

I was customizing Main Menu for my application and some how i deleted edit item from Main Menu. Now my application needs to put this Edit Menu in Main menu. I am not able to drag NSMenu directly to main menu from Interface builder.

I am not able to insert this edit menu programmatically.
So, how can i add "Edit" menu item in Main menu.


Thanks.



Thomas Harte
Jun 1, 2009, 11:15 AM
You should be able to drag the "Edit Menu Item" (or any of the other menu items) directly onto the menu wherever you want it to be positioned. However, after a quick check, this doesn't work if you have any of the pull down menus in the menu you are editing currently open.

HiRez
Jun 1, 2009, 06:04 PM
Yeah, I think the naming is a little confusing. "Menu" refers to the entire thing (all individual drop-down menus together), and not an individual drop-down list as you might think each of these is actually a "Menu Item", the same as each individual line in the list. So as Thomas says, drag a Menu Item onto the menu bar for a new drop-down list ("File", "Edit", etc.).

xmax
Jun 1, 2009, 11:36 PM
Yeah, I did it. Naming was confusing me.

Thanks.