Re: [Q] doubleAction on a NSTableView misbehaving?
Re: [Q] doubleAction on a NSTableView misbehaving?
- Subject: Re: [Q] doubleAction on a NSTableView misbehaving?
- From: Corbin Dunn <email@hidden>
- Date: Thu, 02 Apr 2009 13:31:02 -0700
Hi Eric,
The documentation for setDoubleAction on a NSTableView states:
If the double-clicked cell is editable, this message isn’t sent
and the cell is edited instead.
Oops! Can you please use the "documentation feedback" to log some
feedback and say that is incorrect.
<snip>
Actually, what appears to work well is:
- (void) handleDoubleClickOnListView:(id)sender
{
...
if ( ( hitTestResult & NSCellHitEditableTextArea ) ==
NSCellHitEditableTextArea ) {
if ( [self tableView:resourcesList shouldEditTableColumn:
[[resourcesList tableColumns] objectAtIndex:column] row:row] ) {
[resourcesList editColumn:column row:row
withEvent:currentEvent select:YES];
}
}
else if ( ( hitTestResult & NSCellHitContentArea ) ==
NSCellHitContentArea ) {
}
}
Basically, I just have the double click method start the edit if
needed.
While you can do this, and it is totally acceptable to do so, I'd like
to advise against it (unless you have a specific need to do this). The
main purpose of the change that was done was to make NSTableView allow
things have a -doubleAction to do some real "action", while the single-
click (on text) still allows editing. This is something commonly
understood, since Finder has set a long-time precedent for it. If your
app starts editing on a double-click, then it might stand out as
behaving strangely. But, I understand the reasoning for adding such
code, since some of your users may be expecting that legacy behavior.
Another good example WRT hit testing is PhotoSearch:
http://developer.apple.com/samplecode/PhotoSearch/index.html
It answers 80% of the table questions on this list.
thanks,
corbin
_______________________________________________
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:
This email sent to email@hidden