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 11:37:02 +0200
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.
I've been reading a book about programming for Windows 3.1 at work
(ugh) and it just happens that I read a passage about this very issue a
few days ago.
I can believe it works like this for Windows 3.1 though. It has been a
while, but that was about the worst API I have ever seriously programmed
for. But seriously, you take a Windows 3.1 programming guide as the
basis for Cocoa behaviour?
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.