user486134
user486134

Reputation: 415

How to receive notifications when moving Window by mouse?

I tried -setFrame:display: and -windowDidMove: but they are not sent while moving window.

Upvotes: 4

Views: 3018

Answers (2)

Justin Boo
Justin Boo

Reputation: 10198

If You want to track NSWindow live moving, it's not possible by default You’ll have to do it on your own. It's possible to get notification when NSWindow is started to drag (move) with NSWindowWillMoveNotification or ended dragging (moving) - NSWindowDidMoveNotification.

Take a look at these examples they can help You to solve live window moving problem:

1. Example:

Description: Very short category on NSWindow that makes windows post NSWindowDidMove notifications continuously during dragging (much like NSWindowDidResizeNotification behaves). Uses a secondary thread and behavior can be toggled.

Download link.

2. Example:

Project download link.

Upvotes: 5

Nikolai Ruhe
Nikolai Ruhe

Reputation: 81868

You can register an observer for NSWindowDidMoveNotification.

Upvotes: -1

Related Questions