Re: NSTableView setDoubleAction/NSControl setAction
Re: NSTableView setDoubleAction/NSControl setAction
- Subject: Re: NSTableView setDoubleAction/NSControl setAction
- From: David Martin <email@hidden>
- Date: Wed, 7 Aug 2002 11:56:55 +0200
On Wednesday, August 7, 2002, at 11:37 , Gerben Wierda wrote:
On Wednesday, August 7, 2002, at 11:10 , Angela Brett wrote:
At a point in my app I set the actions for a certain NSTableView:
[fileTable setAction:@selector( inspect:)];
[fileTable setDoubleAction:@selector( trueinspect:)];
This works, but with a twist. The single click action works, but the
double click action runs *both*. Is this a bug in NSTableView?
I would assume this is how it is supposed to work. Think about it...
at the first click, nobody knows whether it's going to be a
doubleclick or not, so it has to be treated as a single click. Then
when the second click happens the doubleclick action is sent. The
first click of a doubleclick should usually do the same thing as a
normal click would, because at that stage you don't know whether
there's going to be a doubleclick or not.
ProjectBuilder has different actions (showing in a pane or a separate
window) for clicking or doubleclicking on files, but there is a delay
after the single click before it will show the file, because it has to
wait to make sure there isn't going to be another click. You could do
something like that by a timer or something in the single click
action, so that it wouldn't do its thing until after a certain amount
of time without the doubleclick action being called.
I find this hard to believe. Because it means in effect that I have to
implement my own 'turn two single clicks into a double click'. Done
correctly I should get the user's mouse settings from somewhere. It is
all very non-OO. The delay looks more like having to find and load the
information to me. This click/doubleclick stuff is very deep inside the
frameworks (NSEvent), it is completely unbelievable I should have to
implement this at the app level.
If you override -[NSResponder mouseDown:] with something like that:
- (void)mouseDown:(NSEvent *)event {
NSLog(@"mouseDown: %d", [event clickCount]);
}
You'll see a single line with a clickCount of 1 for a single click, and
two lines, first with a clickCount of 1, then a clickCount of 2 for a
double click.
Bye,
David
_______________________________________________
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.