Moving a Custom Shaped window
Sarah Reichelt
sarahr at genesearch.com.au
Mon Jun 6 20:38:22 EDT 2005
> What a snap it is to create a custom shaped window! Really cool.
> But how do make it so the user can still drag the window around
> their desktop? I can't seem to grab any part of it to move it.
>
Hi Zack,
Because the custom shaped window doesn't have the usual title bar
which effectively gives you window dragging for free, you need to
write your window drag routines. Put this set of handlers in the
stack or card script:
local sMousePos
on mouseDown
put the mouseH & "," & the mouseV into sMousePos
end mouseDown
on mouseMove x,y
if sMousePos is empty then exit mouseMove
set the topLeft of this stack to (item 1 of the screenMouseLoc -
item 1 of sMousePos), \
(item 2 of the screenMouseLoc - item 2 of sMousePos)
end mouseMove
on mouseUp
put empty into sMousePos
end mouseUp
on mouseRelease
mouseUp
end mouseRelease
And don't forget that you need to add a way for the user to close the
window as well:
on mouseDoubleUp
close this stack
end mouseDoubleUp
HTH,
Sarah
More information about the use-livecode
mailing list