Lock position nswindow

Is it possible to lock the position of nswindow? I am not asking for setIgnoresMouseEvents. I need to prevent the user from moving the window, but he should still use nstoolbar.

thanks in advance --molter

+4
source share
2 answers

I would agree with Jason on β€œnormal” cases. But I think that there are special situations when he can arrange such a thing. Apparently, Apple also thinks so; starting with 10.6 - all you have to do is call NSWindows'

- (void)setMovable:(BOOL)flag 

or override

 - (BOOL)isMovable; 

in a subclass of NSWindow to change window mobility.

If this is not available, the Quartz Event Services API ( documentation ) provides ways to prevent window movement. One way would be to set the touch on an event and manipulate incoming events to only contain the initial mousedown location instead of the updated (real) location when the user starts dragging the window.

+9
source

You should follow Jason's advice and use kiosk mode. See This is a technical note on it.

+1
source

All Articles