PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Drag and Drop  (Read 621 times)

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Drag and Drop
« 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?

Devon Austen

  • Administrator
  • Diamond Member
  • *****
  • Posts: 382
  • Don’t Panic
    • View Profile
    • PVX Plus Technologies
Re: Drag and Drop
« Reply #1 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
Principal Software Engineer for PVX Plus Technologies LTD.

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: Drag and Drop
« Reply #2 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.

Mike King

  • Diamond Member
  • *****
  • Posts: 3811
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Drag and Drop
« Reply #3 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.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

Thomas Bock

  • Diamond Member
  • *****
  • Posts: 177
    • View Profile
Re: Drag and Drop
« Reply #4 on: January 26, 2023, 03:46:23 AM »
Mike

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