Dragging an image to a card?

Doug Lerner doug at webcrossing.com
Sat Feb 14 02:56:26 EST 2004


On 2/14/04 3:37 PM, "Yves COPPE" <yvescoppe at skynet.be> wrote:

> 
> Le 13 févr. 04, à 23:56, Doug Lerner a écrit :
> 
>> I can browse for an image file and upload it and place the image in a
>> card
>> with the answer file dialog.
>> 
>> Is there some way of doing this by dragging an image file to the card
>> instead? That would be a nice option, and many applications allow you
>> to do
>> that...
>> 
>> doug
>> 
>> _______________________________________________
>> 
> 
> 
> It's very easy.
> 
> Look in the archives, Klaus Major has written a sample stack that
> explains the process.
>

Interesting. In his script (below) do you see what restricts the images from
being dragged just to the image area, etc?

on dragenter
  set the acceptdrop to true
  ## otherwise you could not drop anything... :-(
end dragenter

on dragdrop
  put the dragdata
  ### just put the path into the msg for info
  
  switch char -4 to -1 of the dragdata
    ### Here is just check the suffix of the dropped files...
    ### Much room for enhancements... ;-)
    
  case ".gif"
  case ".jpg"
  case ".png"
    set the filename of img 1 to the dragdata
    break
  case ".txt"
    put url("file:" & the dragdata) into fld 1
    break
  case ".rtf"
    set the rtftext of fld 1 to url("file:" & the dragdata)
    break
  case ".mov"
  case ".swf"
  case ".avi"
  case ".mpg"
  case ".wav"
  case ".aif"
    set the filename of player 1 to the dragdata
    break
  end switch
end dragdrop



More information about the use-livecode mailing list