Discussion in 'Mac Programming' started by mahaboob, Aug 22, 2008.

  1. mahaboob macrumors member

    Jul 10, 2008
    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.
  2. HiRez macrumors 603


    Jan 6, 2004
    Western US
    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:

    - (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.

Share This Page