Drag a window without a title bar

Mark Schonewille m.schonewille at economy-x-talk.com
Thu Jun 2 16:22:59 EDT 2011


Bill,

here's mine...

on mouseDown
     if "button" is not in the name of the target then grabWindow
     else pass mouseDown
end mouseDown

on grabWindow
     if the platform is "MacOS" and (the decorations of the \
            defaultStack contains "title" or the decorations of the \
            defaultStack is "default") then
          put 22 into myMenuCorrection
     else
          put 0 into myMenuCorrection
     end if
     put "10,10,310,310" into myRect
     add myMenuCorrection to item 2 of myRect
     lock messages
     put (trunc(the width of this window/2) - the mouseH) into difH
     put (trunc(the height of this window/2) - the mouseV) into difV
     repeat until the mouse is up
          put the loc of this window into loc1
          put the screenMouseLoc into loc2
          add difH to item 1 of loc2
          add (difV + myMenuCorrection) to item 2 of loc2
          -- add (difV ) to item 2 of loc2
          if loc1 is not loc2 then set the loc of this window to loc2
     end repeat
     unlock messages
end grabWindow

You may want to adjust the mouseDown handler.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

New: Download the Installer Maker Plugin 1.6 for LiveCode here http://qery.us/ce

On 2 jun 2011, at 21:33, Bill Vlahos wrote:

> I have a stack that uses the windowshape property so it no longer has the title bar. What is the handler I should use to allow the user to drag the stack around? I have a background image that the user could click and drag for moving the window.
> 
> Thanks,
> Bill Vlahos





More information about the use-livecode mailing list