Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Adding items to menus

Adding items to menus
Thread Tools
iOliverC
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Feb 15, 2004, 11:35 AM
 
What im trying to do is create a simple bookmarks system.

I have 5 simple NSPopUpButtons (these are the groups) , and what I want to do is when I click a button, a sheet appears (done this) and I input data like Name and URL. They then click OK, and whichever group they chose to put the menu item in, appears in the menu. So when they click that menu item, it then takes them to the appropriate url they inputted. I've got all the code for a single item, I just need it where users can add bookmarks. Any sample code or something similar someone knows?

Thanks,
Oliver
     
itai195
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Feb 15, 2004, 06:24 PM
 
I don't know of any code samples for this, but assuming that you've created a 'Bookmarks' menu in IB, all you should need to do is create an NSMenu * outlet in your controller object and connect it to your Bookmarks menu in IB. When the user creates a new bookmark, just send your bookmark menu object the - (id <NSMenuItem>)addItemWithTitle : (NSString *)aString action : (SEL)aSelector keyEquivalent : (NSString *)keyEquiv message with the title provided by the user and the selector being whichever method you want called when the menu item is activated.

EDIT: They really need a way to disable smilies when posting obj-c code...
     
Brass
Professional Poster
Join Date: Nov 2000
Location: Tasmania, Australia
Status: Offline
Reply With Quote
Feb 15, 2004, 07:30 PM
 
Originally posted by itai195:
EDIT: They really need a way to disable smilies when posting obj-c code... :hmm:
Like the "disable smilies" button on the reply page? :)
     
itai195
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Feb 15, 2004, 08:40 PM
 
LOL, I should actually look next time before I complain
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 06:21 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,