Reliable Custom Window Dragging in LC7?

Scott Rossi scott at
Sun Aug 9 08:45:41 CEST 2015

Yes, dragging can work by itself.

But create a new untitled stack in the IDE.  Click between between the new
stack and the windowShaped stack and drag them around.  Over here, when
clicking on the windowShaped stack after the standard stack, there is a
delay while the window becomes active, and then dragging is thrown way
off, depending on how fast you drag.


Scott Rossi
Creative Director
Tactile Media, UX/UI Design

On 8/8/15, 11:24 PM, "Mike Bonner" <bonnmike at> wrote:

>Just tried it here, this old script seems to work fine for me 7.0.6..
><-- source
>Sorry if you've already tried this method.
>*local* sgDragging, sgLeftOffset, sgTopOffset
>*on* mouseDown
>    *put* item 1 of the mouseLoc into sgLeftOffset
>    *put* item 2 of the mouseLoc into sgTopOffset
>    *put* true into sgDragging
>*end* mouseDown
>*on* mouseMove
>    *lock* screen
>    *if* sgDragging is true *then*
>        *set* the left of this stack to item 1 of globalloc(the mouseLoc)
>        *set* the top of this stack to item 2 of globalloc(the mouseLoc) -
>    *end* *if*
>    *unlock* screen
>*end* mouseMove
>*on* mouseRelease
>    *put* false into sgDragging
>*end* mouseRelease
>*on* mouseUp
>    *put* false into sgDragging
>*end* mouseUp
>On Sat, Aug 8, 2015 at 10:56 PM, Scott Rossi <scott at>
>> Hi All:
>> Is anyone still making custom-shaped stacks out there that use scripts
>> manage window dragging?
>> I've noticed for some time now that custom window drag routines which
>> to work in all past versions of LiveCode now seem to be ineffective in
>> LC7.  For example, if you have a couple of stacks with custom
>> and click/drag to reposition them, it takes LiveCode several cycles to
>> make the window active and catch up with the cursor position.  And when
>> the stack finally starts moving, it's position is way off from where the
>> click first occurred on the stack.
>> To work around this problem, I figured out a new dragging routine that
>> seems to work pretty reliably, but it relies on some tactics that have
>> been discouraged in the past, such tracking the screenMouseLoc and
>> the mouse state.  Here's the script I'm using (applied using a
>> local mLoc
>> before mouseDown
>>    trackDrag
>> end mouseDown
>> command trackDrag
>>    repeat while the mouse is "down"
>>       put the screenMouseLoc into SML
>>       set topLeft of this stack to item 1 of SML - item 1 of mLoc,\
>>       item 2 of SML - item 2 of mLoc
>>    end repeat
>> end trackDrag
>> before mouseMove X,Y
>>    put X,Y into mLoc
>>    pass mouseMove
>> end mouseMove
>> I know there aren't a ton of people building stacks with custom
>> windowShapes and appearances out there.  And while the above has been
>> working for me for a while now, I'm still curious if anyone else has run
>> into this and come up with an alternate solution.
>> Thanks & Regards,
>> Scott Rossi
>> Creative Director
>> Tactile Media, UX/UI Design
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>use-livecode mailing list
>use-livecode at
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:

More information about the use-livecode mailing list