Dropping file on an LC standalone...

Bob Sneidar bobsneidar at iotecdigital.com
Thu Mar 21 18:58:58 EDT 2024

Wow I just read that and it didn’t even make sense to me!

Basically with Windows, dragging a file onto a taskbar icon only adds the file to the icon’s Pinned items. Dragging a file onto an open window of an App will try and open the file in that app. If the app’s window(s) are hidden, dragging and hovering over the app’s shortcut will cause the app to show it’s window(s) whereupon you can drop the file onto the open window.

Bob S

On Mar 21, 2024, at 3:46 PM, Bob Sneidar via use-livecode <use-livecode at lists.runrev.com> wrote:

Does it have to be the icon? If I drag a file onto an app in the Windows Tack Bar it does nothing, even if the file belongs to the app I am dragging the file onto. If however I HOVER on the icon and the app is running, it will bring the app to the front and show the frontmost window if it is hidden.

If I drag the file onto the open Window, the app will open it. Case in point, drag an Excel spreadsheet onto the Excel icon in the task bar. All it will do is add a shortcut to the Excel icon for that file. But launch Excel, open a blank spreadsheet, then drag an excel file onto the icon, hover, then drop onto the blank Excel Spreadsheet. In THIS case it will open the spreadsheet in a new window.

Because of this you may be able to use a Drag / Drop handler in your card script. The caveat is that the card itself will not accept a drag/drop action, but if you drag anything on top of an actual object, THEN the card will get the message.

So to handle this, add an opaque rectangle the size of the card behind everything else (if the opacity is set to 99 it will appear transparent for all intents and purposes). The rectangle (or any other object on the card that doesn’t have a dragDrop handler) will get the message and it will fall through to the card where you can handle it.

This in my card script:

on dragEnter
  set the dragAction to "link" -- for files
  pass dragEnter
end dragEnter

on dragDrop
  put the dragData into tDragData
  set the dragData to empty
  -- do something with tDragData
end dragDrop

More information about the use-livecode mailing list