Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
- Subject: Defining Accessors in a Custom Palette for a NSArray for Cocoa Bindings
- From: "E. Wing" <email@hidden>
- Date: Wed, 5 Jan 2005 17:45:29 -0800
I'm trying to make a custom palette and expose a value for Cocoa
bindings. In a nutshell, my palette plots a single line. (Really dumb
stuff for now.)
In my custom palette, I have an NSMutableArray which I want to contain
an array of LinePoints (which is a simple subclass of NSObject
basically containing 3 floats for x,y,z and accessors) which will
define the line.
I have exposed this value through bindings using [self exposeBinding:
@"singleLine"] in my +initialize method for my palette.
My hope is that the user of my palette can bind this value to
something like a table in their application and my custom palette view
will automatically draw and update itself to the view without needing
to know anything about the implementation or writing any code. (So if
the user of the final app clicks Add on the table, this value
immediately gets added to the plot.)
But right now I am having trouble defining my behavior for things like
Inserting/Removing, and editing. In my palette, I cannot figure how to
override these behaviors. I need to override these methods because I
need to write code in these to actually draw stuff to the screen.
Currently, using NSLog() statements everywhere, I can see that my
set/get SingleLine accessors are being called (which is good).
But I tried defining things like:
-(void)insertObject:(LinePoint*)entry isSingleLineAtIndex:(unsigned int)index;
-(void)removeObjectFromSingleLineAtIndex:(unsigned int)index;
but these never seemed to get called.
I'm probably missing something, like telling the system (some how)
that my NSMutableArray contains LinePoints as elements and that it
should call these methods I want. But I'm not sure how to do that.
Can somebody tell me what I need to do to define insertion, removal,
and editing actions in my palette for my NSArray?
Thanks,
Eric
_______________________________________________
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