Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 8, 2011, 09:25 PM   #1
Fritzables
macrumors regular
 
Join Date: May 2011
Location: Brisbane AUSTRALIA
[NSPopUpButton] "titleOfSelectedItem" ??

Hi to All,

As some of you are aware, I am in my very early stages of developping for Mac after leaving Windows to take up with Mac. I still have a lot to learn and enjoying the new skills.

My question is. If I have created an object of NSPopUpButton and called it myPopUp (in this example).

In it's simplessed form, would I return the string of the selected item like this:

Code:
NSString *returnedValue = [myPopUp titleOfSelectedItem];
Or have I missed the mark by a long shot ??

Pete
Fritzables is offline   0 Reply With Quote
Old Jun 8, 2011, 09:49 PM   #2
mfram
macrumors 6502a
 
Join Date: Jan 2010
Well, probably the more standard way to do it is to create a Pop Up button by dragging it to your window in Interface Builder. Then create an outlet to the button in whatever controller you want.

Then yes, you should be able to call:

Code:
NSString *sel = [mybutton titleOfSelectedItem];
or maybe

Code:
NSInteger sel = [mybutton indexOfSelectedItem];
... which ever is more convenient. Assuming mybutton is declared as an outlet to the button.
mfram is offline   0 Reply With Quote
Old Jun 8, 2011, 10:16 PM   #3
Fritzables
Thread Starter
macrumors regular
 
Join Date: May 2011
Location: Brisbane AUSTRALIA
Thanks mFram,

Will look at the IBOutlet tonight.
Thanks heaps.

Pete
Fritzables is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting 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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
NSPopUpButton binding question Spraystarch Mac Programming 2 Jul 27, 2008 08:52 AM
NSPopupButton bindings with NSArrayController satyam90 Mac Programming 1 Jun 12, 2008 06:12 AM
How to set the first entry in NSPopUpButton satyam90 Mac Programming 3 Feb 4, 2008 11:24 AM
Control NSArrayController Selection with NSPopUpButton? stadidas Mac Programming 7 Jan 27, 2008 10:58 AM
NSPopUpButton vs. Cocoa Bindings Error HiRez Mac Programming 3 Mar 10, 2006 05:21 AM


All times are GMT -5. The time now is 05:26 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC