Re: Cocoa Bindings and popups
Re: Cocoa Bindings and popups
- Subject: Re: Cocoa Bindings and popups
- From: Chuck Musser <email@hidden>
- Date: Mon, 19 Jul 2004 21:32:28 -0700
I just mocked this up in IB (a table view that I can edit three
columns in, and connected that array controller to the pop up menu.
As each was added/updated the popup changed.
It's something else...
Yeah, it's gotta be. I did make the capitalization changes others
suggested for the method declarations and it didn't get things working.
I think you've got an extra connection in there.. that first
ObjectController shouldn't be necessary
I thought it was a bit odd too, but I'm new and was cribbing from an
example. I did try the alternative you suggest. See comment below.
Create an NSArrayController and bind it's content array to the
variable that contains the ride list
then bind the popup menu to that array controller.
When I create an NSArrayController, the binding inspector's Bind To
field for contentArray only offers two choices: Shared User Defaults and
Files Owner (NSApplication). In my application, the main controller for
the GUI is a subclass of NSObject called PostController. This object
contains the instance variable that holds the NSMutableArray that I want
to bind to the popup. So I can't figure out how to make the connection.
I tried the following avenues in Interface Builder:
1.) I tried subclassing NSObjectController to make a class that would
replace my current controller. My theory was that IB wouldn't allow me
to bind to something that wasn't an NSObjectController or a descendant
thereof. Unfortunately, IB wouldn't allow me to instantiate my new
subclass. I highlighted it in the Classes tab, but the Instantiate menu
item was grayed out. So I guess the two questions here are: Is the the
right approach? and How come I couldn't instantiate the class?
2.) I tried creating a new NSArrayController, control-dragged a
connection from it to my main controller, and connected the "content"
outlet.
Again, the hope was that my main controller object would show up in the
Bind To popup for the NSArrayController's contentArray. Sadly this did
not work either.
So it looks like I've got structural problems. This project is in its
early stages, so I'm certainly not averse to rejiggering it and starting
over. I'm just not sure what to try next.
How are you adding the items to the array?
My main controller object also manages a sheet that allows the user to
enter information about a new item. That code adds items to the
NSMutableArray. I have confirmed that new objects are added to the array.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.