1. Drag ' n ' Drop
- Posted by Selgor Jan 13, 2016
- 1995 views
Hello.
Selgor here.
I am still waiting for a Euphoria drag and drop routine .
All other languages have it . Be nice if Euphoria could boast of it .
Hi Don Cole . Thought you had given up on Euphoria .
Still waiting .
Cheers.
selgor.
2. Re: Drag ' n ' Drop
- Posted by Spock Jan 17, 2016
- 1944 views
Hello.
Selgor here.
I am still waiting for a Euphoria drag and drop routine .
All other languages have it . Be nice if Euphoria could boast of it .
Hi Don Cole . Thought you had given up on Euphoria .
Still waiting .
Cheers.
selgor.
Just about any GUI library will have support for this. See.
Spock
3. Re: Drag ' n ' Drop
- Posted by Selgor Jan 20, 2016
- 1860 views
Thank you Spock for your reply.
Al Getz is a long way back but still good code. Adaptable.
I have launchpad working but it is "bloated".
Big oblong blocks with inset name .
Not simple.
difficult to modify.
But Spock ... thanks for your trouble to reply.
Cheers.
Selgor.
4. Re: Drag ' n ' Drop
- Posted by DonCole Jan 22, 2016
- 1829 views
Hello Selgor,
Nice to hear form you again.
I was changing a lot of things around in my life (I had to move).
Now that's done.
I've been using Euphoria all along but haven't been on the forum much.
I switched from Window 7 to Windows 8.1.
Not an east task as far as Euphoria programs are concerned.
I intend to upload a program in the future that will work with Windows 8, Windows 8.1 and Windows 10.
That's what I'm working on now.
Al Getz has a program in a program in the archives called "Launch Pad(v4.03)"
That allows you drag and drop a shortcut into it.
It's written in Arwen which is a derivative of Euphoria or Euphoria is a derivative of Arwen, I'm not sure which.
Don Cole
5. Re: Drag ' n ' Drop
- Posted by bugmagnet Feb 10, 2016
- 1708 views
Arwen is listed on the openeuphoria site .. but you already knew that.
Bugmagnet
6. Re: Drag ' n ' Drop
- Posted by Spock Feb 10, 2016
- 1665 views
Arwen is listed on the openeuphoria site .. but you already knew that.
Bugmagnet
<Ahem> I really should update that but my development version has been converted to Orac-style which means that although it is more convenient to program it is not fully compatible with Euphoria. In any case, I think Al Getz would have used his own WinClass to demonstrate Drag 'n Drop rather than my Arwen.
To use Drag 'n Drop in Windows one must first register the control by passing its native handle to xDragAcceptFiles. Then when the event occurs the message WM_DROPFILES is sent to the control's handler. To retrieve the file/folder names one has to pass wParam to getDroppedFiles() (which wraps xDragQueryFile).
For anyone interested here are the relevant routines in Arwen (probably ripped from Edita and which also need some tweaking to work in Euphoria):
Spock
global procedure setDragAndDrop(int id, int onoff) -- To enable Drag 'N Drop the user must register the window with setDragAndDrop() -- to accept dragged files and then capture the WM_DROPFILES msg calling -- getDroppedFilenames(wParam) to get the file names -- The window can be unregistered via setDragAndDrop() as well to NOT accept dropped files atom hWnd = ObjectHwnd[id] c_proc(xDragAcceptFiles, {hWnd, onoff}) end procedure -- -- global function getDroppedFiles(atom handle) --The DragQueryFile function retrieves the filenames of dropped files. -- --UINT DragQueryFile( -- HDROP hDrop, // handle to structure for dropped files -- UINT iFile, // index of file to query, 0-based -- LPTSTR lpszFile, // buffer for returned filename -- UINT cch // size of buffer for filename -- --hDrop - Identifies the structure containing the filenames of the dropped files. --iFile - Specifies the index of the file to query. If the value of the iFile parameter is 0xFFFFFFFF, DragQueryFile returns a count of the files dropped. If the value of the iFile parameter is between zero and the total number of files dropped, DragQueryFile copies the filename with the corresponding value to the buffer pointed to by the lpszFile parameter. --lpszFile - Points to a buffer to receive the filename of a dropped file when the function returns. This filename is a null-terminated string. If this parameter is NULL, DragQueryFile returns the required size, in characters, of the buffer. --cch - Specifies the size, in characters, of the lpszFile buffer. -- --When the function copies a filename to the buffer, the return value is a count of the characters copied, not including the terminating null character. --If the index value is 0xFFFFFFFF, the return value is a count of the dropped files. --If the index value is between zero and n-1 and the lpszFile buffer address is NULL, the return value is the required size, in characters, of the buffer, not including the terminating null character. -- get number of files dropped int count = c_func(xDragQueryFile, {handle, #FFFFFFFF, 0, 0}) -- early out? if not count then return {} end if -- init seq names = {} for i = 1 to count do -- get buffer size required int size = 1 + c_func(xDragQueryFile, {handle, i-1, 0, 0}) -- get some buffer space atom pBuffer = fast_allocate(size) -- call the API to fill the buffer with the name size = c_func(xDragQueryFile, {handle, i-1, pBuffer, size}) -- retrieve the null-terminated string seq name = peek({pBuffer, size}) -- peek_string(pBuffer) names = append(names, name) end for return names end function -- -- global function getDroppedFile(atom wParam) -- try to get some names seq tmp = getDroppedFiles( wParam ) -- early out? if not ~tmp then return "" end if -- success if seq(tmp.1) then return tmp.1 end if -- exit, failed return "" end function