drag question

Eric Chatonet eric.chatonet at sosmartsoftware.com
Fri Jan 18 05:07:14 EST 2008

Hi Mark,

I put a large image on a card then added some grouped label fields on  
First not any mouseDown will be sent to the group when you don't  
click on an object in this group: this is normal :-)
Second, I noticed that mouseDown is received when clicking on a field  
but the grab command is not executed :-(
Sounds like a bug to me...

Here is a workaround.
In the script of the image:

on mouseDown
   grab me
end mouseDown

And in the group's script:

local lAllowDrag
on mouseDown
   put the mouseH - the left of img "Artwork" & comma & the mouseV -  
the top of img "Artwork" into lAllowDrag
end mouseDown
on mouseMove x,y
   if lAllowDrag is empty then exit mouseMove
   set the topleft of img "Artwork" to (x - item 1 of lAllowDrag &  
comma & y - item 2 of lAllowDrag)
end mouseMove
on mouseUp
   put empty into lAllowDrag
end mouseUp
on mouseRelease
end mouseRelease
on mouseEnter
   put empty into lAllowDrag
end mouseEnter

Now you can move the image from anywhere.
Hope this helps.

Le 18 janv. 08 à 03:56, Mark Swindell a écrit :

> I have an image that resides below a group and is not part of the  
> group.  The group consists of  a collection of fields which have no  
> scripts and are not focusable.  In the group script I placed the  
> handler:
> on mouseDown
> grab image "artwork"
> end mouseDown
> This works if don't select directly over a field, and I can adjust  
> the position of the  image by dragging it around.    If I click  
> over a field it doesn't work.  I'm assuming the mouseDown if being  
> trapped by the field.  But shouldn't it be passed along to the  
> group script?
> I'm not outside the bounds of the image.
> Can anyone clarify what is happing here, or suggest another  
> approach to being able to move the image around?
> Thanks,
> Mark

Best regards from Paris,
Eric Chatonet.
Plugins and tutorials for Revolution: http://www.sosmartsoftware.com/
Email: eric.chatonet at sosmartsoftware.com/

More information about the use-livecode mailing list