Prevent someone from dragging a toplevel window, or...

Mark Talluto userev at canelasoftware.com
Sun May 1 20:25:48 EDT 2005


On May 1, 2005, at 12:42 AM, Ken Ray wrote:

> (a) Prevent someone from dragging a window that is a toplevel window
> (without a "snapback" solution of resetting the window after the drag 
> is
> complete); or

Here is a crazy idea.  Could you draw a stack over the drag bar when 
needed?  Something like this example could get you started.  Not sure 
if you can make the stack invisible yet be there.  This is quick and 
dirty.  Sure it could be cleaned up a lot.

local lStackY, lStackX

on mouseMove
   put the screenMouseLoc into temp
   put item 1 of temp into lMouseX
   put item 2 of temp into lMouseY
   put the top of this stack into lStackX
   put the left of this stack into lStackY

   if lMouseY < (lStackX+10) then
     if lFlag is "true" then exit mouseMove
     put "true" into lFlag
     createBlockerStack
   else
     if exists (stack "blocker") then delete stack "blocker"
     put empty into lFlag
   end if
end mouseMove


on mouseLeave
   createBlockerStack
end mouseLeave



on createBlockerStack
   set the vis of the templateStack to false
   set width of the templateStack to the width of this stack
   set the height of the templateStack to 20
   create stack "blocker"
   reset the templateStack
   set the decorations of stack "blocker" to empty
   set the style of stack "blocker" to palette
   set the shadow of stack "blocker" to false
   set the topleft of stack "blocker" to lStackX,(lStackY-21)
   set the vis of stack "blocker" to true
end createBlockerStack



Mark Talluto
-- 
CANELA Software
http://www.canelasoftware.com



More information about the use-livecode mailing list