Edit AllPages

Tracking a moving window is tough as notifications are not send during the dragging but only just prior to start and upon ending (or pausing). This is oftentimes enough, but sometimes it just is not. Particularly uncomfortable is the fact that a dragged window does not respond to [window frame] as the General/WindowServer manages dragging and “freezes” the window’s frame rect accessors.

A possible solution to that problem is implemented in my sample “TrackingAWindowFrame” ( ) and briefly outlined on my blog post:

The sample project compiles to an application with two windows, a “compass” and a “magnet”, with the compass needle always pointing towards the magnet, no matter which windows is moved or resized. The exact coordinates and dimensions of the magnet window are also written to text fields in the compass window and continuosly updated during dragging or resizing: