Re: Binding popup contents difficulties
Re: Binding popup contents difficulties
- Subject: Re: Binding popup contents difficulties
- From: Ken Tozier <email@hidden>
- Date: Mon, 29 May 2006 13:20:38 -0400
Well,made a little progress, but now what's happening is that the
entire array appears as a single menu item.
I think there is something fundamental I'm not understanding about
binding and array controllers. The purpose of the accessor method in
the model class is to provide the entire contents of the array, no?
Unfortunately though this seems to mash the array into a single item
(like going [array description]) and placing this description as the
menu's sole item. How exactly are you supposed to fill a menu?
There's no mechanism to specify the model key path for items within
an array say like sites[#].
Please help almost 8 hours now trying to fill the contents of a
single menu. This is getting extremely frustrating.
Thanks
Ken
On May 29, 2006, at 10:06 AM, Ken Tozier wrote:
Still haven't figured it out yet but here's the most recent error
I'm getting
2006-05-29 09:48:39.668 QuarkXPress[2701] [<NSArrayController
0x117b9c10> addObserver:<NSSelectionBinder 0x117bfbf0>
forKeyPath:@"site.name" options:0x0 context:0x0] was sent to an
object that is not KVC-compliant for the "site" property.
Here's the accessor that shows that the target class is indeed KVC
compliant for the "site" property.
- (NSArray *) site
{
return [properties objectForKey: @"site"];
}
Here's the structure of the return from the above method
(
{id=1, name='Boston'},
{id=2, name='New York'},
{id=3, name='Chicago'},
{id=4, name='Los Angeles'},
etc...
)
I've looked at all of mmalc's examples here http://homepage.mac.com/
mmalc/CocoaExamples/controllers.html particularly the "PopUpTest"
project and I just don't see what I'm doing that is all that
different, other than his example is for shared defaults while mine
is for a popup in a dialog
I've been futzing with this for around four hours now trying every
combination of content, content + contentValues, selected values I
can think of, nothing works. What the heck am I doing wrong here?
On May 29, 2006, at 3:01 AM, Ken Tozier wrote:
Hi
I'm having some problems binding the contents of a popup button.
Here's what I've done so far.
1. Create a properties dictionary in my NSWindowController
subclass with the following structure
{
site = {
{id=1, name='Boston'},
{id=2, name='New York'},
{id=3, name='Chicago'},
{id=4, name='Los Angeles'},
etc...
}
}
2. create an accessor method to get the sites from the property
dictionary
- (NSArray *) site
{
return [properties objectForKey: @"site"];
}
3. In the nib file, set the custom class of the file's owner to
MyWindowController.
4. Create an NSArrayController in the nib and connect its
"content" outlet to the file owner
5. Add a "site" key to the array controller.
6. Tried binding the popup to the array controller in each of the
following ways:
- content
Bind to: PopupArrayController
Controller Key: arranged objects
Model key path: <tried leaving empty and entering "site">
-> Result empty popup
- content + contentObjects
Content:
Bind to: PopupArrayController
Controller Key: arranged objects
Model key path: <tried leaving empty and entering "site">
Content Objects:
Bind to: PopupArrayController
Controller Key: selection
Model key path: <tried leaving empty and entering "site">
-> Result empty popup
- contentValues
Bind to: PopupArrayController
Controller Key: site
Model key path: <tried leaving empty and entering "site">
-> Result empty popup
Anyone point out what I'm doing wrong here?
Thanks for any help
Ken
P.S. does anyone know of a good site that explains binding options
in detail? There's so many options for each binding property, it's
really confusing trying to figure out why they were created in the
first place and what situations call for what options.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40comcast.net
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40comcast.net
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden