Drag & Drop question

Jan Schenkel janschenkel at yahoo.com
Wed Jun 30 00:54:47 EDT 2010


I think the button you're dragging along will get in the way of the drop. It's better to update the dragImage rather than try and move a 'shadow' button around the card; besides, it won't show once your drag goes outside the window.

Add an image, set its name to "DragImage" and hide it. Then use the following code:
##
on dragStart
   set the itemdel to tab
   set the label of btn "DragData" to \
          item 2 of the hilitedText of me
   export snapshot from btn "DragData" \
          to image "DragImage" as PNG
   set the dragImage to the short id of image "DragImage"
   set the dragData["text"] to the hilitedText of me
   pass dragStart
end dragStart
##

You can always play around with the dragImageOffset to better align the dragImage with the cursor.

HTH,

Jan Schenkel.
=====
Quartam Reports & PDF Library for Revolution
<http://www.quartam.com>

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


--- On Tue, 6/29/10, tkuypers at telenet.be <tkuypers at telenet.be> wrote:
> ok, something weird is happening and
> I'm lost...
> 
> I have a list with some lines of text of which I want to
> drag from.
> Next I have a button on which I want to drop onto.
> 
> I've created an invisible button, whose label is set to the
> line I selected, and becomes visible in the "dragStart"
> handler of the field.
> 
> Script in field:
> on dragStart
>    set the itemdel to tab
>    set the label of btn "DragData" to item 2
> of the hilitedText of me
>    show btn "DragData"
>    set the dragData["text"] to the
> hilitedText of me
>    pass dragStart
> end dragStart
> 
> on dragEnd
>    hide btn "DragData"
> end dragEnd
> 
> on dragMove
>    set the loc of btn "DragData" to the
> mouseLoc
>    pass dragMove
> end dragMove
> 
> 
> And now the strange thing.
> Drag & drop works fine, the button accepts the drop,
> but moving the "text-lable-button" is choppy and  stops
> when I leave the field.
> 
> So I moved the "DragMove" handler out of the field and
> moved it to the card script.
> Moving is really smooth now, the button follows the mouse
> very nice, but the drop doesn't work anymore... The button
> that should receive the dragData just doesn't react
> anymore.
> 
> What am I missing?
> 
> I'm on a Mac and using the latest version of RR
> (4.5.0-dp-3), but 4.0.0-gm-1 reacts the same.
> 
> Any help is welcome!
> 
> 
> Met vriendelijke groeten,
> Warm Regards,
> 
> PublishingTools 4 U
> Ton Kuypers
> +32 (0) 477 739 530
> 
> Aardbemden 11 • B-2400 • Mol • Belgium
> www.publishingtools4u.com
> 
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage
> your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
> 


      




More information about the Use-livecode mailing list