Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mahaboob

macrumors member
Original poster
Jul 10, 2008
31
0
Hi all,
As a part of my project I'm using NSPopUpButton. I have some items in the popup button. What I want to do is,
When I selecting an item in the pop up menu I want to display something in the text field and when the selection changed then the text field should also change. well, which method I want to implement to track the selection changing in PopUpButton ?

Thanks in advance.
 
One way is to create an action method which will be called when the popup button is changed. Connect it to the object that contains the method in IB. It might look something like this:

Code:
- (IBAction)changeThing:(id)sender {
	[myTextField setStringValue:[sender titleOfSelectedItem]];
}

The other way to do that would be to use Cocoa Bindings. How you make that work would depend on how you want to store the data.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.