PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Thomas Bock on January 24, 2023, 01:28:48 AM

Title: Drag and Drop
Post by: Thomas Bock on January 24, 2023, 01:28:48 AM
I have a listbox containing filenames and want to drag a file from it to another non-PxPlus-application. How can I do that?
Title: Re: Drag and Drop
Post by: Devon Austen on January 24, 2023, 08:05:24 AM
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
Title: Re: Drag and Drop
Post by: Thomas Bock on January 25, 2023, 01:34:04 AM
Devon,

I want to drag files from a PxPlus listbox and drop it on a control of an external application.
Title: Re: Drag and Drop
Post by: Mike King on January 25, 2023, 10:05:25 AM
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.
Title: Re: Drag and Drop
Post by: Thomas Bock on January 26, 2023, 03:46:23 AM
Mike

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