• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Maintaining NSCursor outside of app window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Maintaining NSCursor outside of app window


  • Subject: Re: Maintaining NSCursor outside of app window
  • From: Corbin Dunn <email@hidden>
  • Date: Thu, 13 Jan 2011 16:37:25 -0800

Hi Markus,

Use:

- (void)draggedImage:(NSImage *)draggedImage movedTo:(NSPoint)screenPoint

Then do something like this (after converting the screen point to window coords):

    NSPoint windowPoint = [[view window] mouseLocationOutsideOfEventStream];
    NSPoint localPoint = [view convertPoint:windowPoint fromView:nil];
    if (![view mouse:localPoint inRect:[view visibleRect]]) {
        [[NSCursor disappearingItemCursor] set];
    }

corbin


On Jan 13, 2011, at 4:11 PM, Markus Spoettl wrote:

> Hello,
>
>  I have a drag-n-drop UI where I use the [NSCursor disappearingItemCursor] to indicate that if you drop now, you're going to remove the item being dragged. I do this by setting the cursor when my dragging destination receives a -draggingExited: message (the dragging destination and source are the same, an NSView subclass).
>
> It works well inside the application but when the cursor leaves the application window, things break down. When this happens the cursor is reset to the default arrow cursor. What's worse is that it doesn't return to -disappearingItemCursor when the cursor re-enters my window - not view - without releasing the mouse.
>
> What I'd like to get to is a behavior like that of Finder. When you drag a "Places" item out of the source list Finder somehow manages to maintain the cursor, even if the app behind the cursor is something else.
>
> My drag starts with a call to NSView's -dragImage:at:offset:event:pasteboard:source:slideBack:
>
> I'd rather not implement the whole dragging UI (transparent foreground window occupying the entire screen, painting the drag image myself - at least I think that's how it could work) if I can avoid it because I fear there are countless little traps to hit on the way.
>
> Is there a way not to get the cursor reset by AppKit behind my back?
>
> Regards
> Markus
> --
> __________________________________________
> Markus Spoettl
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> 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:
>
> This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Maintaining NSCursor outside of app window
      • From: Uli Kusterer <email@hidden>
    • Re: Maintaining NSCursor outside of app window
      • From: Markus Spoettl <email@hidden>
References: 
 >Maintaining NSCursor outside of app window (From: Markus Spoettl <email@hidden>)

  • Prev by Date: Re: sending a message from an initializer method
  • Next by Date: Re: Maintaining NSCursor outside of app window
  • Previous by thread: Maintaining NSCursor outside of app window
  • Next by thread: Re: Maintaining NSCursor outside of app window
  • Index(es):
    • Date
    • Thread