Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Preventing menu shortcuts



Hello...

You can create an event tracking loop in the code that initates the window drag, similar to what is described in the "Handling Mouse Events in Views" section of the conceptual topic on "Basic Event Handling" which has an example of an event tracking loop for NSButton near the end.
<http://developer.apple.com/documentation/Cocoa/Conceptual/BasicEventHandling/Tasks/HandlingMouseEvents.html#//apple_ref/doc/uid/20000906>


You would basically just need to change the actions for the switch statement, moving the window appropriately for the NSLeftMouseDragged case, and setting the bool to end the loop for the NSLeftMouseUp case. If your timer also does something else like run some sort of animation, you'll want to add periodic events to your event tracking loop as described in the paragraph right after the example.

Hope that helps,

	Louis


I have custom window dragging code that runs in a timer, and I'd like to prevent the user from being able to use menu shortcuts while they are dragging the window, as the standard window dragging behavior does (I don't want the user to close the window or quit the application while they are dragging a window, for example). How is this accomplished? Do I need to run a modal loop for the window being dragged or is there a better way?

Tim


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.