Re: NSTableView select a single cell
Re: NSTableView select a single cell
- Subject: Re: NSTableView select a single cell
- From: Sergey Shapovalov <email@hidden>
- Date: Mon, 4 Jun 2007 10:03:38 +0400
On Jun 2, 2007, at 7:17 PM, email@hidden wrote:
Hi,
I have a NSTableView with 3 columns. Each column datCell is set to my
subclass of NSTextFieldCell, so I can set text + image in each
single cell.
Well, it works. Now, I would like the user clicks on a single cell
and see
ONLY that cell selected and highlighted. Instead I cannot get rid
of the
whole row selection made automatically by NSTableView.
Any idea?
Well, if I had to implement the behavior you desire, I'd try:
a) implementing a custom cell class;
b) overriding mouseDown and mouseUp for the table control.
In mouseDown and mouseUp, I'd figure out what cell should be selected
(from the coordinates of the point where the click happened - can get
them from the event). In my custom cell class, I'd implement custom
drawing procedure (override drawWithFrame:inView:) to draw different
background for selected and non-selected cells. Not to mention that
image+text cells itself do require using custom NSCells; here is a
good starting point provided by Apple (ImageAndTextCell.m):
http://developer.apple.com/samplecode/ImageBackground/listing4.html
Best regards,
Sergey.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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