Drag-And-Drop Image Fun

Jan Schenkel janschenkel at yahoo.com
Thu May 29 03:52:01 EDT 2003

--- Yves COPPE <yvescoppe at skynet.be> wrote:
> >I have been able to successfully work with
> drag-and-drop with text, 
> >but not with PICTURES. My original posting, in
> regards to the 2 
> >problems I encountered with drag-and-drop:
> >
> Hi Igor
> I've asked on this list to jan Schenkel to write a
> nioce code for 
> drag 'n drop for text, from one fld to another.
> I gave us a wonderful code, with a fantastic user
> interface.
> Perhaps he could do the same with image ?
> Hey Jan, are you ready ???
> -- 
> Greetings.
> Yves COPPE

Eep, why is everyone looking at me for examples ?
*hides under his desk*
Seriously now, apart from a simple test stack to check
a few things, I haven't used the new drag'n'drop
features all that much ; the stack for drag'n'drop
between list fields doesn't use the standard messages
; and graphics/multimedia isn't really my field.

However, here's my take on things (UNTESTED) :
- since it wants .PNG formatted image data, you'll
need to convert both its imageData _and_ its
maskData/alphaData into that format
- you might want to look at the 'export' command in
the dictionary ; it allows you to export to a file or
even a container in a certain format (aha!)
- you can then stuff this in the dragData["image"] and
give it a whirl.

As for visual interaction, that's a whole different
ballpark. If you're only dragging between image
controls on the same card, then here's another
- temporarily create a new image control of the same
size as the source, 
- set its imageData to the imageData of the source and
its alphaData too
- tinker its blendLevel so its more translucent

And either :
- in the card script, trap the dragMove message and
set the location of the temp image to something around
the mouseLoc
- or start a 'send in 5 milliseconds' cycle to
accomplish the same movement of the temp image

Hope this gets you closer to a solution.

Jan Schenkel.

"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).

More information about the use-livecode mailing list