• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Getting notifications while window is moving?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting notifications while window is moving?


  • Subject: Getting notifications while window is moving?
  • From: email@hidden
  • Date: Fri, 8 Feb 2002 12:33:57 -0800

I'd like to get notifications _while_ a window is moving on the screen.
windowWillMove and windowDidMove are not enough, I need the coordinates
between the two events.

Background:
I want to implement snapping together two windows as soon as they are a
maximum distance apart.

Any suggestions how I could get this information?

Subclassing NSWindow and overriding something like setFrame: to look at the new frame and then call super ought to work. You might even be able to modify the frame before sending it on up to super, to do your "snap". I don't know how well this will work, but this is what I'd look into.
In my app Constrictor, I just do the whole window drag myself from start to finish. However, I can do that because I'm making a custom window. I don't know if there's any (public) way to plug into what happens when a normal window (i.e. one with a title bar) gets a click in the title bar. Even if it isn't public, you could look into that, though, too. Break in gdb when you receive the -windowWillMove and -windowDidMove notifications, and see if there's somebody interesting in the backtrace that you might override to completely replace the Kit's window-dragging code with your own. I'd do this only as a last resort, though; overriding setFrame: sounds very promising to me.

Ben Haller
Stick Software
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Is this a bug in NSTextView or a feature?
  • Next by Date: Re: Multiple nibs
  • Previous by thread: Re: Two ?'s: Default code for NSView & FileMerge problem
  • Next by thread: Termination of threads.
  • Index(es):
    • Date
    • Thread