NSButtonCell's within NSCell's within NSTableView's and mouse tracking
NSButtonCell's within NSCell's within NSTableView's and mouse tracking
- Subject: NSButtonCell's within NSCell's within NSTableView's and mouse tracking
- From: "John C. Daub" <email@hidden>
- Date: Fri, 24 Oct 2003 08:14:18 -0500
Hello.
I've got some complex data to display in an NSTableView, so it's been
suggested to me to take the route of embedding NSCell's within an NSCell,
then putting that "master" NSCell into the NSTableView's column. Generally
speaking this works out ok, but I'm hitting some snags.
One of the embedded NSCell's is an NSButtonCell (a checkbox). Since the
NSButtonCell is merely rendered within the master NSCell, clicks on the
checkbox are not actually picked up. I've searched around and found out you
have to handle the mouse tracking yourself. But this ends up not being a
pretty solution since you then have to mimic all of the control behaviors
yourself.
For instance, I want the clicks to be tracked if the user clicks in the
checkbox itself. As it is, I am able to get the frame of the NSButtonCell,
but that's bigger than the actual rendered checkbox so a user clicking just
outside of the little blue square that is the actual checkbox still
activates the checkbox tracking. I don't want that, just clicks within the
little blue square. How can I find out the frame of the actual checkbox that
the NSButtonCell is rendering?
Also, mouse tracking on the checkbox doesn't occur... the tracking is
actually on the cell/table itself. So not only does this mean there's no
tracking of the clicks on the control (e.g. click-hold, move outside of the
checkbox, release to cancel the click), but if I drag into another row of
the table then the table's selection highlighting kicks in. I don't want the
selection highlight to kick in, and I do want proper control tracking to
occur. I assume I have to override the mouseDown method and handle all of
this myself, yes?
Am I missing anything towards getting this checkbox to actually function
like a real control, and not just a faked rendering within the table?
So all of this makes me wonder... is this the way to go? Should I be faking
things out with NSCell's embedded within an NSCell? Or would it be better to
actually try to put real NSView's and NSButton's into the NSTableView? Can
that be done? If so, what are the pros and cons of such an approach?
Thanx.
--
John C. Daub }:-)>=
<
mailto:email@hidden> <
http://www.hsoi.com/>
"Lemon curry?"
_______________________________________________
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.