Dragfiles On MAC

Just starting out? Need help? Post your questions and find answers here.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Dragfiles On MAC

Post by collectordave »

Is it possible to drag files from my application to another on the mac?

I am looking at DragDrop.pb from the help file and only the Image can be dragged.

Is this correct behaviour?

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Dragfiles On MAC

Post by collectordave »

I cannot find anything about it but have a maybe workaround.

After creating a folder and the file I want the user to drag I open Finder with just that file they can then use finders drag and drop.

Not perfect but seems to work. Code adapted from another post.

Code: Select all

Dest$ = GetUserDirectory(#PB_Directory_Documents) + "My Exports/St Pierre.csv"
RunProgram("open", "-R " + Chr(34) + Dest$ + Chr(34), "")
Would be better if we could start the drag operation with a script.

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Dragfiles On MAC

Post by collectordave »

Just tried it and it works.

Start users web browser to display upload page

Wait a couple of seconds.

Start Finder to display file on top of web browser

User can drag file to upload box.

Just need to do the same for windows now.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Marc56us
Addict
Addict
Posts: 1479
Joined: Sat Feb 08, 2014 3:26 pm

Re: Dragfiles On MAC

Post by Marc56us »

Is it possible to drag files from my application to another on the mac?
Just need to do the same for windows now.
I don't have a Mac, but I don't see what the difficulty is for Windows (or I didn't understand the question ?)
Drag a file from a PB application (ie: ExplorerListGadget) to any other Windows appli or folder is easy:

Code: Select all

RunProgram(GetUserDirectory(#PB_Directory_Documents))
OpenWindow(0, 0, 0, 400, 200, "") 
ExplorerListGadget(1, 10, 10, 380, 180, "*.*")
Repeat  
    If WaitWindowEvent()    = #PB_Event_Gadget          And 
       EventType()          = #PB_EventType_DragStart   And 
       EventGadget()        = 1   
        DragFiles(GetGadgetText(1) + GetGadgetItemText(1, GetGadgetState(1)))    
    EndIf  
Until WaitWindowEvent() = #PB_Event_CloseWindow
Making a D&D of a file from or to a PB application consists in passing the full file name. It is PB or the system that will do the necessary conversion to the object. As usual, PB do the job for you.
:wink:
User avatar
mk-soft
Always Here
Always Here
Posts: 5398
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Dragfiles On MAC

Post by mk-soft »

Something was changed on the macOS system (from version High Sierra).
Since then, dragging lists (ListView, ListIcon, etc) no longer works.

Press left mouse button and move mouse is now multi-selection
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Shardik
Addict
Addict
Posts: 1989
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: Dragfiles On MAC

Post by Shardik »

Marc56us wrote:I don't have a Mac, but I don't see what the difficulty is for Windows (or I didn't understand the question ?)
On MacOS drag 'n drop support is broken since PB 5.00 (with the change from the Carbon framework to the Cocoa framework). About 7 years ago fsw had posted this summary with links to bug postings concerning MacOS drag 'n drop. Fred posted this answer in that thread:
Fred wrote:Cocoa drag'n'drop model is not fully compatiable with PB model, I don't know how to work around it (for now).
Some features of drag 'n drop work in MacOS like drag 'n drop of images. For another broken feature exists an uncomfortable workaround like drag 'n drop for the ListIconGadget.

This simple example demonstrates how to drag files from Finder into an EditorGadget and display their paths and names.
Post Reply