Subclassing NSCell: Checkbox and Text?
Subclassing NSCell: Checkbox and Text?
- Subject: Subclassing NSCell: Checkbox and Text?
- From: Jamie <email@hidden>
- Date: Fri, 4 Jun 2004 09:25:25 +0100
Hi all.
I read a post here
-
http://cocoa.mamasam.com/COCOADEV/2003/11/1/76622.php - that addresses
a similar issue, but I am a cocoa newbie, and I need some more help :(
I am looking to make a custom subclass of NSCell to display a checkbox
and a text label value in an NSOutlineView, much like the interface on
Apple's installer application.
I am a very new cocoa programmer, and I could just do with a bit more
explicit advice to point me in the right direction. I am looking to
integrate the new custom cell with cocoa bindings. I was going to
start by trying to adapt apple's own Imageandtextcell class to work in
that situation and work from there.
... (from the post linked above re ImageAndTextCell)...
" The ImageAndText cell requires two variables to be set; you can only
bind a single value. If the value contained both the text and the
image (for example in a dictionary) that would work (assuming the
ImageAndTextCell knew the keys to use to extract the information from
the dictionary)."
I understand that. So I am guessing that you would override
-setObjectValue / -objectValue, and then point the image and text
accessors / setters to lookup the relevant key the dictionary (if that
was the object you were now using in setObjectValue). That way KVB can
look each element OK. So now we would have a way of programatically
setting each value individually, or both together and also to retrieve
them in the same ways.
What don't understand, is how you would then get your NSArrayController
to use that object with bindings. I don't actually want to be able to
change the label from the outline view, just the selected state, so
effectivly I only want to bind the checkbox value to my array - but it
would be nice to know how to bind each value independently. From my
understanding, I would have to bind my NSArrayController to my custom
cell programatically if I wanted to be able to set each value
separately.
I guess at the end of the day I am just very confused, and I could do
with someone who knows what they are doing explaining what methods I
need to implement and how I go about actually binding to my new object.
Here's hoping one of you can give a budding learner a leg up!
Many thanks
Jamie
_______________________________________________
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.