Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7022215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:33:10+00:00 2026-05-27T23:33:10+00:00

I have an NSArrayController that I fill in the awakeFromNib method. The data has

  • 0

I have an NSArrayController that I fill in the awakeFromNib method. The data has the keys: id, name, and description. I have a ComboBox and a TextField bound to the NSArrayController the first with the name and the second with the id. If I change the selection in the ComboBox I want the value in the TextField to change, and vice-versa. I read the docs for TextField and ComboBox bindings, but I didn’t understand how to achieve this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T23:33:10+00:00Added an answer on May 27, 2026 at 11:33 pm

    The trick here is that you need somewhere else to put the value of the NSComboBox. The NSArrayController is fine for providing the stock values to the NSComboBox, but you can type arbitrary values into an NSComboBox that might not be in the NSArrayController’s contentArray, so it’s not surprising that you need somewhere else to put the value. I was able to mock this up quickly by just putting a simple value on the AppDelegate like this:

    @interface SOAppDelegate : NSObject <NSApplicationDelegate>
    
    @property (assign) IBOutlet NSWindow *window;
    // The NSArrayController you were talking about...
    @property (assign) IBOutlet NSArrayController* popupValues;    
    // The other place to store data...
    @property (retain) id comboBoxValue;
    
    @end
    

    Then in the implementation:

    @implementation SOAppDelegate
    
    @synthesize window = _window;
    @synthesize comboBoxValue = _comboBoxValue;
    
    - (void)dealloc
    {
        [_comboBoxValue release];
        _comboBoxValue = nil;
        [super dealloc];
    }
    
    -(void)awakeFromNib
    {    
        [super awakeFromNib];
        NSMutableDictionary* item1 = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
                                      [NSNumber numberWithUnsignedInteger: 1], @"id", 
                                      @"Item 1 Name", @"name", 
                                      @"Item 1 Description", @"description", 
                                      nil];
        NSMutableDictionary* item2 = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
                                      [NSNumber numberWithUnsignedInteger: 2], @"id", 
                                      @"Item 2 Name", @"name", 
                                      @"Item 2 Description", @"description", 
                                      nil];
        NSMutableDictionary* item3 = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
                                      [NSNumber numberWithUnsignedInteger:3], @"id", 
                                      @"Item 3 Name", @"name", 
                                      @"Item 3 Description", @"description", 
                                      nil];
    
        NSMutableArray* array = [NSMutableArray arrayWithObjects: item1, item2, item3, nil];
        self.popupValues.content = array;
    }
    
    @end
    

    Then for the bindings, I set it up like this:

    NSComboBox:

    • Content -> Array Controller.arrangedObjects
    • Content Values -> Array Controller.arrangedObjects.name
    • Value -> App Delegate.comboBoxValue (check Continuously Updates Value if you want the NSTextField to be updated letter-by-letter as you’re typing in the NSComboBox)

    NSTextField:

    • Value -> App Delegate.comboBoxValue (check Continuously Updates Value if you want the NSComboBox to be updated letter-by-letter as you’re typing in the NSTextField)

    If you want new values you type in to be added to the array, I’m sorry to say, that’s not readily doable with just these two controls and bindings. That’s a fair bit more complicated. But the trick for the simple case is that you need some place to store the value other than the NSArrayController you’re using to provide pre-loaded values to the NSComboBox.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a NSCollectionView is bound to an NSArrayController that has an NSMutableArray as
I have a managedObjectContext for the main application that has a bound NSArrayController and
Context: I have an NSArrayController tied to Core Data that supplies rows for an
I have an NSTableView bound to a core-data-backed NSArrayController by binding individual columns to
I have an NSArrayController that I'm using to provide data to an IKImageBrowserView. I
I have some trouble with a core data project. I have a NSArrayController with
I have an NSTableView that binds via an NSArrayController to an NSMutableArray. What's in
Current Situation: Direct Binding I have an NSTableView which displays the data that comes
I have an NSArrayController and I would like to sort the contents so that
I have an NSTableview which s bound to a NSArrayController. The Table/Arraycontroller contains Core

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.