Re: NSTableView, file promises, and the message queue
Re: NSTableView, file promises, and the message queue
- Subject: Re: NSTableView, file promises, and the message queue
- From: olivier <email@hidden>
- Date: Wed, 14 May 2003 09:00:47 -0500
For the problem of the event queue sticking when dragging from the
datasource: just return YES to the method writeCell... I seem to
remember that i had to do a few trick after that to keep everything
working as expected, but that should get rid of the sticking. The only
problem left is that when dragging, it will behave as if you did two
drags, one for the promise, one for the regular so you'll sometimes get
a slide back effect (minor annoyance in my case).
As for overriding mouse down, you have to set a periodic event so
you'll know if you need to start a drag or just select or anything else.
NSEvent startPeriodicEventsAfterDelay: 0.3 withPeriod: 0];
NSEvent *newEvent = [[self window] nextEventMatchingMask:
NSLeftMouseUpMask | NSLeftMouseDraggedMask |
NSPeriodicMask];
switch ([newEvent type]) {
case NSLeftMouseUp:
break;
case NSPeriodic:
[self doPromiseDrag: theEvent];
break;
case NSLeftMouseDragged:
break;
default:
break;
hope this helps.
Olivier
On Wednesday, May 14, 2003, at 07:23 AM, David Remahl wrote:
>
On Wednesday, May 14, 2003, at 02:06 PM, Nick Zitzmann wrote:
>
>
> On Tuesday, May 13, 2003, at 09:41 AM, Tim Hewett wrote:
>
>
>
>> I have promised file drag&drop working (it was a joyous
>
>> occasion when that happened :-) ), no application sticking.
>
>> It looks like you are trying to fit promised files around the
>
>> more normal drag&drop API, I don't think you can do that,
>
>> I think you have to subclass NSTableView (see below) and
>
>> overload some methods. Don't rely on the Jaguar developer
>
>> CD Cocoa documentation to cover promised files properly,
>
>> it doesn't (well mine doesn't), you have to look at the Apple
>
>> on-line documentation. That is where my code came from.
>
>
>
> I tried your approach and it didn't work.
>
>
>
> First of all, subclassing -mouseDown: and adding the drag stuff makes
>
> the program assume I'm dragging something as soon as the mouse is
>
> down. Also, it completely breaks the table view action and
>
> double-click action, both of which I need to preserve.
>
>
>
> So, I tried subclassing -mouseDragged: and for some reason, the
>
> subclass method is never called.
>
>
The reason for that is that NSTableView starts event tracking in
>
mouseDown: and doesn't stop tracking until the mouse button is
>
released. That makes it difficult to overload - since you would have
>
to figure out exactly what mouseDown: does except for catching drags.
>
>
> Then, I tried capturing the next event using NSApplication, and that
>
> appears to block unless I set the expiration date to be [NSDate
>
> date], which doesn't work.
>
>
>
> So I'm all out of ideas. Has anyone made this work flawlessly? As I
>
> said before, my solution worked, but I end up with a stalled message
>
> queue...
>
>
I've tried both your approach and the subclassing method, without
>
success...Could someone who managed to do it please post some sample
>
code?
>
>
/ Rgds, 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.
_______________________________________________
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.