Re: NSPopupButton and bindings to NSArrayController
Re: NSPopupButton and bindings to NSArrayController
- Subject: Re: NSPopupButton and bindings to NSArrayController
- From: John Joyce <email@hidden>
- Date: Sun, 27 Jul 2008 22:43:56 -0500
On Jul 27, 2008, at 9:56 PM, email@hidden wrote:
When attempting to use NSPopupButton and bindings to
NSArrayController, as a means to navigate an array of objects, is
there any tutorial or example out there?
I don't believe specifically for your case (ie, an NSPopUpButton),
but this list's archives contain various (attempts at) textual
explanations.
I keep getting "cannot perform operation without a managed object
context"
This would seem to imply that I should be using CoreData.
In Interface Builder, inspect the Attributes of your array
controller. You'll see a mode control that lets you specify whether to
use a Class or an Entity. You most likely have Entity selected (which
requires a MOC, as the error says). Select "Class" instead.
Is CoreData really the way to go when trying to do much more with
bindings ?
No. The two interoperate very well by design but are not mutually
inclusive.
--
I.S.
Well, I already checked that, it is Class, not Entity. I'm already
aware that Entity is used with Core Data models.
Oh, well, I'll figure something out.
I always have a terrible time with NSPopupButton in any context.
NSArrayController provides some nifty methods, selectNext: and
selectPrevious:
but I need a select: that chooses a specific item from the array.
Either by index or what have you.
I did find setSelectionIndex: in NSArrayController's header, but I had
to do some awkward things to make it work.
I created an IBOutlet for my array controller, set the Interface
Builder instance as that outlet, then was able to set the action of
the NSPopupButton to a method in MyDocument which wraps
setSelectionIndex: and passes the selection from the NSPopupButton to
it.
Obviously, I've already built this app with my own glue code. So I
know how it can work.
I've got my own reference, I just need to make more sense of bindings
to make the NSPopupButton sync well with my array of text objects. My
textView should change its contents to match selection. I can create
new objects for the view.
Heck, I can even make it work mostly, using a simple, single column
tableView to do selections, but that gives trouble with nextKeyView.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden