For whatever it's worth, I did not find a way to make the tracking area work. I 
do get the mouseEntered and mouseExited messages, but only after the dragging 
has ended - which is precisely when I don't need it any more.

Instead I use the method draggedImage:movedTo: out of the NSDraggingSource 
Protocol to decide if the mouse pointer is inside the view's window's 
rectangle, and I re-assign the cursor accordingly. This happens every time the 
mouse moves until the dragging session is over.

Rainer


On Jun 11, 2010, at 14:37 , Rainer Standke wrote:

> It turns out that things work almost as expected - but not during the drag. 
> This flag seems to have no effect.
> 
> I add the tracking area and then I have this:
> 
> [self dragImage:dragImage at:dragImageCenter offset:NSMakeSize(0.0, 0.0) 
> event:theEvent pasteboard:pboard source:self slideBack:YES];
>       
> NSLog(@"trkArea 2: %@", trkArea);
> 
> Oddly, the log only occurs after the dragging session is over. Does this mean 
> that the dragging session is taking over completely? I tried to add the 
> tracking area in the background and / or to perform the dragImage: method 
> after a delay - seems to make no difference in behavior...
> Any clues as to what's going on?
> 
> Thanks,
> 
> Rainer
>       
> On Jun 11, 2010, at 13:30 , Michael Vannorsdel wrote:
> 
>> I had this happen a couple times when dealing with threading accidents.  If 
>> the tracking rects are added from a secondary thread or the window is 
>> ordered front by a secondary thread, then the tracking areas will be stuck 
>> in a pending state.  There's probably more reasons for this but these are 
>> the two I'm personally familiar with.
>> 
>> 
>> On Jun 11, 2010, at 1:42 PM, Rainer Standke wrote:
>> 
>>> Hello all,
>>> 
>>> I have a subclassed NSImageView that is a drag source and a drag 
>>> destination. I am trying to have an NSTrackingArea so that when the drag 
>>> out of the image view leaves they window I can update the cursor to 
>>> indicate deletion of the item - I am thinking of the cursor that looks like 
>>> an explosion cloud.
>>> 
>>> When I log my tracking area it tells me it's "pending install", and I never 
>>> get any of the expected mouse-move messages.
>>> 
>>> This snippet is in mouseDown on the image view:
>>> 
>>> NSTrackingAreaOptions options = NSTrackingMouseEnteredAndExited | 
>>> NSTrackingEnabledDuringMouseDrag | NSTrackingActiveAlways;
>>>     
>>> NSTrackingArea *trkArea = [[NSTrackingArea alloc] initWithRect:[[self 
>>> window] frame] options:options owner:self userInfo:nil];
>>> 
>>> [self addTrackingArea:trkArea];
>>> [self updateTrackingAreas];
>>>     
>>> NSLog(@"trkArea: %@", trkArea);
>>> 
>>> 
>>> I am running out of ideas what to try - any help would be appreciated.
>> 
>> _______________________________________________
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/lists%40standke.com
>> 
>> This email sent to li...@standke.com
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/lists%40standke.com
> 
> This email sent to li...@standke.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to