Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

custom Cell tracking in NSTableView



Sure you can avoid to select the row.
You have to add this method in the delegate class
and return NO. You can also decide which row can or cannot be unselectable.

- (BOOL)tableView:(NSTableView *)aTableView
                shouldSelectRow:(NSInteger)rowIndex
{
    return NO;
}

Of course you need later to identify the clicked row manually
using mouseDown and keyDown in the NSTableView subclass.
For example

- (void)mouseDown:(NSEvent *)theEvent
{
    NSPoint    curPoint = [self convertPoint:
                    [theEvent locationInWindow] fromView:nil];
    int        row = [self rowAtPoint:curPoint];
    int        col = [self columnAtPoint:curPoint];

    // do something with row and col;
}


Last, if you double click on the word e.g. "tableView" or "rowAtPoint" or
"NSTableView" from your code you will be shown the NSTableView help page and
know more and pick the methods you need.


Best Regards
-- 
Lorenzo
email: email@hidden


> Date: Thu, 25 Oct 2007 14:48:05 -0400
> From: Alexander Cohen <email@hidden>
> Subject: custom Cell tracking in NSTableView
> To: Apple CocoaList <email@hidden>
> Message-ID: <email@hidden>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
> 
> Hi,
> 
> I have a NSTableView that has 2 columns. The last columns is a sort of
> search icon that is a NSButtonCell. When i click on the button, the
> cell is tracked but the row is also selected, is there any way to stop
> the selection from happening and just track the cell?
> 
> thanks

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.