Reliable Custom Window Dragging in LC7?

Scott Rossi scott at tactilemedia.com
Sun Aug 9 00:56:11 EDT 2015


Hi All:

Is anyone still making custom-shaped stacks out there that use scripts to
manage window dragging?

I've noticed for some time now that custom window drag routines which used
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 windowShapes
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 polling
the mouse state.  Here's the script I'm using (applied using a behavior):

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






More information about the use-livecode mailing list