Re: NSTableView setDoubleAction/NSControl setAction
Re: NSTableView setDoubleAction/NSControl setAction
- Subject: Re: NSTableView setDoubleAction/NSControl setAction
- From: Gerben Wierda <email@hidden>
- Date: Wed, 7 Aug 2002 12:21:11 +0200
On Wednesday, August 7, 2002, at 11:51 , Angela Brett wrote:
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.
Well, the frameworks are not psychic... how can they know whether the
user is going to click again? The only way for NSEvent to do it for you
is if it always waited a while before sending the single click action,
and that would make things slower and also a bit more complicated in
the many cases where the first click of a doubleclick does do the same
thing as a single click.
Have a look at David Martin's reply:
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.
In other words, as I said: at the lowest level, an Event comes *with*
knowledge about it being double/single click. That has nothing to do
with being psychic, but with the fact that these action have been
abstracted (we are in an OO-environment after all and not in Windows
3.1).
I see a faint possibility of some complicated (and non-OO) behaviour
here, but that doesn't change that a setDoubleAction for NSTableView
next to an already available setAction (in NSControl) only really makes
sense from an OO-perspective if they are disjunct.
Can someone from Apple shed some light here?
G
_______________________________________________
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.