Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa OSX set cursor during drag operation

When i set the cursor using

- (void)draggingSession:(NSDraggingSession *)session willBeginAtPoint:(NSPoint)screenPoint {
   [[NSCursor closedHandCursor] set];
}

than very soon after it switches back to the default cursor

During drag the cursor rects seems disables

How to set the cursor during drag & drop operation?

like image 528
Peter Lapisu Avatar asked Dec 28 '25 23:12

Peter Lapisu


1 Answers

As well as using set to change the cursor, you can also use the NSCursor methods push and pop - these don't rely on cursor rects. You simply push when you need to set a new cursor, and pop when you want to get back to the cursor being used just before your push call. In your example, try using push when the drag begins, and pop in the delegate method that informs you when the drag is ended.

like image 193
Paul Patterson Avatar answered Dec 30 '25 17:12

Paul Patterson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!