Drag and Drop

Started by Thomas Bock, January 24, 2023, 01:28:48 AM

Previous topic - Next topic

Thomas Bock

I have a listbox containing filenames and want to drag a file from it to another non-PxPlus-application. How can I do that?

Devon Austen

You can allow external applications to drop file names onto a list box by using this directive.

    DROP FILE ON dest_ctl_id RETURN new_ctl_id

Whenever a file is dropped onto the dest_ctl_id control, the system will generate the CTL event specified by new_ctl_id.

The application can get a list of the file pathnames being dropped from the FIN(0, "DROPFILES") function call. All pathnames will be fully expanded and separated by a SEP character.

This can be found in the docs here: https://manual.pvxplus.com/?directives/drop_on.htm#filedrop
Principal Software Engineer for PVX Plus Technologies LTD.

Thomas Bock

Devon,

I want to drag files from a PxPlus listbox and drop it on a control of an external application.

Mike King

Thomas

PxPlus doesn't have the ability to directly provide a list box that you drag files out of, however what you can do is if the files you want to drag can be placed in a directory you can create a Shell.Explorer control on your PxPlus panel pointing to that directory.  Then the user can drag the files out to external applications.

For example:

def object h,@(10,10,30,10)="Shell.Explorer"
h'navigate2("c:\pvxsrc\workarea")

This will create you a window where the directory will be listed and the user can drag the files out of.

One trick you can use if you have a large selection of files in a common directory but only want to allow the user to select specific files is to create a dummy directory then using the Windows mklink command create links to just the files you want the user to have access to.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Thomas Bock

Mike

Thank you. I'll take a look at it.