Desktop Application Object - AllowWindowsDragDrop Property

Allow the application to respond to a Windows drag and drop

Member of Desktop Application Object (PRIM_APPL)

Data Type - Boolean

Details

The AllowWindowsDragDrop property defines whether external drag and drop actions are detected in a LANSA application.

When set to True, an external drag and drop will populate the drag payload with an instance of a FilePaths object containing details of the files being dragged.

Example


Drag and drop dome files from Windows Explorer on to the form. The paths will be listed as son as the drop occurs.

Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientheight(464) Clientwidth(680) Dragstyle(Aggregated) Height(503) Left(313) Top(207) Width(696) Layoutmanager(#TableLayout1) Caption('Drag and drop some files from Windows Explorer')

Define_Com Class(#PRIM_TBLO) Name(#TableLayout1)
Define_Com Class(#PRIM_TBLO.Column) Name(#Column1) Displayposition(1) Parent(#TableLayout1)
Define_Com Class(#PRIM_TBLO.Row) Name(#Row1) Displayposition(1) Parent(#TableLayout1)
Define_Com Class(#PRIM_TBLO.Item) Name(#FilesItem1) Column(#Column1) Manage(#Files) Parent(#TableLayout1) Row(#Row1)

Define_Com Class(#PRIM_LTVW) Name(#Files) Columnbuttonheight(20) Componentversion(2) Displayposition(1) Dragstyle(Automatic) Fullrowselect(True) Height(464) Keyboardpositioning(SortColumn) Left(0) Parent(#COM_OWNER) Showsortarrow(True) Tabposition(1) Top(0) Width(680)
Define_Com Class(#PRIM_LVCL) Name(#LVCL1) Displayposition(1) Parent(#Files) Source(#xDemoCaption) Widthtype(Remainder) Caption('Files') Captiontype(Caption)

Evtroutine Handling(#com_owner.CreateInstance)

#Sys_Appln.AllowWindowsDragDrop := True

Endroutine

Evtroutine Handling(#Files.DragOver) Payload(#Payload) Acceptdrop(#AcceptDrop)

#AcceptDrop := (#Payload *Is #Prim_Appl.iDragDropFilePaths)

Endroutine

Evtroutine Handling(#Files.DragDrop) Payload(#Payload)

Clr_List Named(#Files)

If (#Payload *Is #Prim_Appl.IDragDropFilePaths)

Begin_Loop To((#Payload *As #Prim_Appl.IDragDropFilePaths).FileCount)

#xDemoCaption := (#Payload *As #Prim_Appl.IDragDropFilePaths).FilePath<(#Files.Entries + 1)>
Add_Entry To_List(#Files)

End_Loop

Endif

Endroutine

End_Com


See also

All Component Classes

Technical Reference

  • No labels