Knowing when a window is being dragged?

  • I am trying to implement a functionality in a window such that what's
    inside of a window changed while the window is been dragged around
    the screen by the user.  It's actually a little subtler than that --
    I need the window to change when the user clicks left mouse down on
    the title bar and to change back to normal when left mouse is
    released.  This should happen regardless of whether the mouse down is
    followed by moving the window, or whether the user moves the window
    in phases -- move, pause (with mouse down), move, pause, etc.

    I first tried doing this by hooking into windowWillMove and
    windowDidMove but couldn't quite get it to work.  For example, if the
    user does a quick left click on the title bar of the window,
    windowWillMove is sent but the window is not really moving.  There
    can be a second (or many more) windowWillMove without a windowDidMove
    in between if the user continues to single-click left mouse in the
    window titlebar.  When the user actually moves the window, there will
    be one or more windowDidMove sent.

    Speaking of windowdidMove, if the user moves the window a bit, then
    stops, then moves, then stops -- all of this while still holding down
    the left mouse button on the title bar -- then multiple windowDidMove
    are sent.

    Perhaps there is some way of implementing some convoluted logic that
    will try and figure out wheat exactly is happening with all these
    notifications but that doesn't appear to be an elegant enough
    solution.  And mouseUp and mouseDown don't get to the window when on
    the titleBar area.

    Has anyone figured out a simple, robust, "strictly-documented-only"
    way of doing the above?  I read in the archives about the transparent
    overlay of the titlebar approach but it still seems quite complicated.


    -- ivan
previous month october 2006 next month
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31          
Go to today