Drag-And-Drop Image Fun

yves COPPE yvescoppe at skynet.be
Wed May 28 06:52:00 EDT 2003


>Dear RunRev Friends,
>
>A couple of questions, regarding the new drag-and-drop functions of 
>version 2.0:
>
>PROBLEM 1:
>I'm having trouble dragging IMAGE information. I want to allow the 
>user to drag an image onto an 'imageWell' object. The imageWell 
>should accept the drag if there is image information in the dragged 
>object, and upon drop, it should display the image. My problem is 
>that the documentation is a bit unclear as to WHAT exactly it is 
>that we should be setting the dragData["image"] to.  So, here is 
>what I tried:
>
>a) Make new stack. Place a ',png' image in it (our 'source'), and 
>place an 'empty' image object somewhere else in the card (our 
>'target' object) - which will be our 'imageWell'. I used a PNG image 
>because the documentation states that the image information has to 
>be in 'png' format.
>
>b) In the source image, as per instructions in the language guide, I 
>added the following script:
>
>on mouseDown
>    set the dragData["image"] to me
>end mouseDown
>
>c) In the target image, I added the following script:
>
>on dragEnter
>    if dragData["image"' is not empty then set the showBorder of me to true
>end dragEnter
>
>on dragLeave
>    set the showBorder of me to false
>end dragLeave
>
>on dragDrop
>   put dragData["image"] into me
>end dragDrop
>
>This doesn't work. It appears that dragData["image"] is empty, as 
>there is no change in the appearance of the target image. So I tried 
>changing mouseDown handler of the source image, so that what is 
>stored is the 'imageData':
>
>on mouseDown
>    set the dragData["image"] to the imageData of me
>end mouseDown
>
>No change - except that it does something nasty to Revolution 
>(changes cursors, slows it down) and I have to quite and 
>re-launch... I cannot find any other hints in the documentation as 
>to what it is that I should be doing. Could anyone shed some light?
>
>
>PROBLEM 2:
>In MacOS X, when a user drags an item, there is usually quite a bit 
>of visual feedback given to the user. When a user is dragging 
>something, there is usually a transparent image right underneath the 
>cursor, giving the user some visual hint as to WHAT is being dragged.
>It seems to me that in RunRev, the only visual feedback we can give 
>the user is by changing the cursor image... Is that correct? - or 
>would there be a way to drag a custom 'transparent image', like in 
>OS X, while dragging between windows and applications?
>
>Once again, many thanks in advance for any hints and suggestions!
>




Klaus major has posted a stack in the user-contributions with some of 
samples with drag and drop.
You may also have a look at the website of chipp walters at
http://www.altuit.com/webs/altuit2/RunRev/default.htm

you can see at the dowload page : altThumbviewer stack


Hope this help
-- 
Greetings.

Yves COPPE

Email : yvescoppe at skynet.be



More information about the use-livecode mailing list