S_223FC

LANSA

S_223FC
* ===================================================================
*
* Component : S_223FA
* Type : Form
* Ancestor : PRIM_FORM
*
* Description : Advanced List Views - Drag and Drop
*
* Disclaimer : The following material is supplied as example material
* only. No warranty concerning this material or its use
* in any way whatsoever is expressed or implied.
*
* ===================================================================

FUNCTION Options(*DIRECT)
BEGIN_COM Role(*EXTENDS #PRIM_FORM) Dragstyle(Automatic) Height(346) Left(298) Top(111) Width(509)

* The Drag List Definition. Note the use of the DragStyle(Automatic) property

DEFINE_COM Class(#PRIM_LTVW) Name(#DRAG_LIST) Displayposition(2) Dragstyle(Automatic) Fullrowselect(True) Height(285) Left(8) Parent(#COM_OWNER) Tabposition(2) Top(8) Width(217)
DEFINE_COM Class(#PRIM_LVCL) Name(#LVCL_1) Displayposition(1) Parent(#DRAG_LIST) Source(#EMPNO) Width(53)
DEFINE_COM Class(#PRIM_LVCL) Name(#LVCL_2) Displayposition(2) Parent(#DRAG_LIST) Source(#SALARY) Width(45)

* The Drop List Definition

DEFINE_COM Class(#PRIM_LTVW) Name(#DROP_LIST) Displayposition(1) Fullrowselect(True) Height(285) Left(256) Parent(#COM_OWNER) Tabposition(1) Top(8) Width(217)
DEFINE_COM Class(#PRIM_LVCL) Name(#LVCL_3) Displayposition(1) Parent(#DROP_LIST) Source(#EMPNO) Width(53)
DEFINE_COM Class(#PRIM_LVCL) Name(#LVCL_4) Displayposition(2) Parent(#DROP_LIST) Source(#SALARY) Width(45)

* ===============================
* Handle main form initialization
* ===============================

EVTROUTINE Handling(#com_owner.Initialize)

* Fill the drag list with employee details

Select Fields(#Drag_List) From_File(PSLMST)
ADD_ENTRY To_List(#Drag_List)
ENDSELECT

ENDROUTINE

* ===============================
* Handle Drag Over the drop list
* ===============================

EVTROUTINE Handling(#Drop_List.DragOver) ACCEPTDROP(#AcceptDrop)

* Return the AcceptDrop() value as true, indicating that the drop
* list will accept a drop of the thing(s) that are being dragged

Set #AcceptDrop Value(True)

ENDROUTINE

* =========================================
* Handle the actual drop into the drop list
* =========================================

EVTROUTINE Handling(#Drop_List.DragDrop)

* Go through the drag list and move all the selected
* items (ie: the employees being dragged) into the
* drop list. Then delete them from the drag list.

SelectList #Drag_List
Continue If('#Drag_List.Currentitem.Selected *ne True')
Add_Entry #Drop_List
Dlt_Entry *Current #Drag_LIst
EndSelect

ENDROUTINE

END_COM