Mouse dragging events in NSWindow and NSView

Hi, I have built and application that uses a single window that contains multiple components within it. The main component of the window is a custom NSView subclass that contains a number of CALayers. I want to be able to move these layers around the NSView subclass based on the mouseDown, mouseDragged, and mouseUp events entered by the user. I can detect and process mouse events fine within the NSView subclass, however, whenever I drag the mouse within the NSView subclass right after a mouseDown event, the WHOLE WINDOW will move. I do not want that to happen, that is, when I am dragging the mouse within my NSView subclass, I do not want the whole window to move. I want my CALayers, within the NSView, to move according to the mouse events that I am correctly tracking in the NSView subclass. I will very much appreciate any suggestions. Thank you very much in advance.

iMac 2.8 GHz, Mac OS X (10.5.4)

Posted on Apr 18, 2009 11:09 PM

Reply
Question marked as ⚠️ Top-ranking reply

Posted on Apr 22, 2009 7:26 PM

Override - (BOOL)mouseDownCanMoveWindow and return NO.
2 replies
Sort By: 

May 6, 2009 11:29 AM in response to Peter N Lewis

Thank you very much for your response. Your tip is very useful. What I did before was change the window type in Interface Builder: replace the textured window with a regular window. This solved the problem, however, I could not find the property that needed to be adusted to control the window behavior. I learned something useful with your tip. Thanks again.
Reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Mouse dragging events in NSWindow and NSView

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.