Editing groups and mouse messages

Richard Gaskin ambassador at fourthworld.com
Fri Oct 17 14:55:28 EDT 2008


I need to build a UI similar to the Finder or Windows Explorer, in which 
there are icons that can be moved around, and selecting one brings it in 
front of the others.  To drag you just click and drag of course, and the 
icon first come to the front then does the dragging action.

These icons are in a scrolling group, the Chipp's thread here last month 
on relayering controls was very helpful.

But I've run into a snag:  I move the object to the top of its group on 
mouseDown, and then set my vars needed to handle the dragging so they 
can be used later in mouseMove.  The mouseMove stuff works okay, but I 
never get a mouseUp or mouseRelease to empty my dragging flag. :\

Here's my code - the "put the params" statements in the mouseUp and 
mouseRelease handlers don't fire:


local sIsDragging, xOff, yOff

on mousedown
   lock screen
   start editing grp "Main"
   set the layer of me to top
   stop editing
   unlock screen
   --
   wait 0 with messages
   put true into sIsDragging
   put the mouseH-the left of me into xOff
   put the mouseV - the top of me into yOff
end mousedown

on mouseMove x,y
   if sIsDragging is true then
     set the topleft of me to (x-xOff),(y-yOff)
   end if
   pass mouseMove
end mouseMove

on mouseUp
   put the params
   put empty into sIsDragging
end mouseUp

on mouseRelease
   put the params
   put empty into sIsDragging
end mouseRelease


Am I missing something here, or does editing the background muck with 
some relationship between the target and mouse messages?

-- 
  Richard Gaskin
  Fourth World Media Corporation
  ___________________________________________________________
  Ambassador at FourthWorld.com       http://www.FourthWorld.com



More information about the use-livecode mailing list