Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
- Subject: Re: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
- From: Tim Lucas <email@hidden>
- Date: Thu, 20 Jan 2005 23:53:12 +1100
On 20/01/2005, at 5:52 AM, E. Wing wrote:
Or am I just overthinking everything and missing the obvious?
I think this may be the case.
Have you looked at the bMoviePalette example in
/Developer/Examples/bMoviePalette ? It doesn't use bindings but its a
good start.
I don't know how I missed this one. So I've been taking a look at this
and I'm thinking this may be an easier way to go, creating two palette
objects (a view and a controller) and connecting them with outlets
instead of integrating them into one.
I agree. I tried all I could last weekend trying to instantiate two
types of objects at one go (both an IBViewPboardType and an
IBObjectPboardType) but I ended up giving up.
So now I'm trying to understand the differences between what I want to
do and what this example does. We both access data from an NSTableView
which is interesting to me. In my case though, I think I want to allow
for the editing of points in the table and auto update in the
GraphView and also allow for the GraphView to manipulate points
directly and see them update in the TableView.
To me, this screams Cocoa Bindings through an NSMutableArray. But I'm
not sure how to fit this in to the bMoviePalette example.
Only if you have an array of values. If you just have 3 points then it
doesn't make much sense.
Does this mean the MovieController which is a subclass of NSObject
need to be a subclass of NSArrayController (though I'm not sure how
this works)?
If you're dealing with an array of objects then yep, sure. Setup your
NSArrayController in your Palette's nib file with the correct custom
class and fill in the corresponding keys, then put an outlet in your
IBPalette subclass and connect it to the array controller (the same way
you do for your view).
Make an image for both your objects and chuck two NSImageViews into
your palette's panel, then in finishInstantiate in your IBPalette
subclass use associateObject:ofType:withView: to associate each of the
imageViews with the view and array controller (which you get from your
two outlets).
At the end of the day, if you're not comfortable about using bindings
then you may want to just have an outlet in your view to connect to the
controller, and a outlet in your controller to connect to your
NSTableView. You might even want to make your own subclass of
NSTableView for your data entry, and have the three items in the
palette... the tableview data entry, the controller and the view.
- tim lucas
http://www.toolmantim.com
_______________________________________________
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