Core Data data in a popup button cell, and the case of the missing selector

Discussion in 'Mac Programming' started by GeeYouEye, Jul 6, 2009.

  1. macrumors 68000

    GeeYouEye

    Joined:
    Dec 9, 2001
    Location:
    State of Denial
    #1
    The Interface: (the non-thumbnail image)
    The data:
    Code:
    @interface Job : NSObject {
    NSMutableArray * drainboards; //Yes, I'm allocating memory for it in -init
    ...
    }
    @property (retain) NSMutableArray *drainboards;
    @end
    @implementation Job
    @synthesize drainboards;
    
    The bindings: (images 2-4)
    The explanation: In the left table column in the first image, I mean to have all of the drainboard names in a popup menu in each row. In the right column, a quantity. The drainboard objects are Core Data managed objects, but each row should represent a dictionary(keys: drainboard, quantity), which are contained by the NSMutableArray above. The array controller for the table columns is set to generate NSMutableDictionarys (in the attributes inspector pane), and its Content Array binding is set to Job.self.drainboards.

    The problem: I can add and remove blank rows, but clicking the popup button cell does nothing - no menu with the drainboard names appears. If I try to set a quantity, I get this in stderr
    Code:
     ** -[NSCFDictionary objectAtIndex:]: unrecognized selector sent to instance 0x16563eb0
    .

    Thoughts? Some Core Data or bindings caveat I'm missing? Help!
     

    Attached Files:

  2. thread starter macrumors 68000

    GeeYouEye

    Joined:
    Dec 9, 2001
    Location:
    State of Denial
    #2
    Found part of it; Prepares Content was not checked. The problem now is, instead of drainboard.name(s) in the popup menu, I get:

    <NSManagedObject: 0x1b0cf0> (entity: CCCEDrainboard; id = 0x171290 <x...CEDrainboard/p104; data: { name = "Double Slope"; price = 300 }

    If I bind the column to arrangedObjects.price rather than arrangedObjects.name, I get just the price. Is "name" a reserved word?
     
  3. thread starter macrumors 68000

    GeeYouEye

    Joined:
    Dec 9, 2001
    Location:
    State of Denial
    #3
    If anyone cares, the solution is to bind Selected Object to the Job's NSMutableArray array controller.
     

Share This Page