Drag and drop - %dr

In this section:

%dr (OnDragDrop Callback) takes a call-back function that is called when a file is dropped on to a window. If a collection of files is dropped, the call-back is called for each file in turn. This can be achieved, for example, by the following actions:

· Open the File Manager or Explorer and select one or more files.

· Drag the files to the format window containing %dr.

· Use CLEARWIN_STRING@('DROPPED_FILE') in the call-back associated with %dr.

For example, a text editor could use this feature by opening the droppped file for editing.

The following code illustrates how %dr works:

       WINAPP
       INTEGER i,winio@
       EXTERNAL drop_func
       i=winio@('%ca[Drag and drop]%bg[grey]&')
       i=winio@('Drop files here....&')       
       i=winio@('%dr',drop_func)
       END
c --------------------------------------------------
       INTEGER FUNCTION drop_func()
       INCLUDE <clearwin.ins>
       CHARACTER*129 filename
       INTEGER i
       filename=clearwin_string@('DROPPED_FILE')
       i=winio@('%ca[Dropped file]%bg[grey]&')
       i=winio@('%`20rs&',filename)
       i=winio@('%2nl%cn%tt[Next file]')       
       drop_func=2 
       END

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited