Resolved EventHandler for ListView

Hi everybody,

OE12.5, Win 8 & 10

I have to implement drag & drop on a ListView-Control and found the following C#-example:

listView1.AllowDrop = true; listView1.DragDrop += new DragEventHandler(listView1_DragDrop); listView1.DragEnter += new DragEventHandler(listView1_DragEnter);

How would I do this in ABL ?

TIA, Wolf
 

Osborne

Active Member
Code:
listView1:AllowDrop = TRUE.
listView1:DragDrop:Subscribe(listView1_DragDrop).
listView1:DragEnter:Subscribe(listView1_DragEnter).

If in a class then:

Code:
METHOD PRIVATE VOID listView1_DragDrop( INPUT sender AS System.Object, INPUT e AS System.Windows.Forms.DragEventArgs ):
   MESSAGE "DragDrop" VIEW-AS ALERT-BOX.
END METHOD.

METHOD PRIVATE VOID listView1_DragEnter( INPUT sender AS System.Object, INPUT e AS System.Windows.Forms.DragEventArgs ):
   MESSAGE "DragEnter" VIEW-AS ALERT-BOX.
END METHOD.

Else if a procedure - for the subscribes enclose in quotes:

Code:
PROCEDURE listView1_DragDrop:
   DEFINE INPUT PARAMETER sender AS System.Object NO-UNDO.
   DEFINE INPUT PARAMETER e AS System.Windows.Forms.DragEventArgs NO-UNDO.

   MESSAGE "DragDrop" VIEW-AS ALERT-BOX.
END PROCEDURE.

PROCEDURE listView1_DragEnter:
   DEFINE INPUT PARAMETER sender AS System.Object NO-UNDO.
   DEFINE INPUT PARAMETER e AS System.Windows.Forms.DragEventArgs NO-UNDO.

   MESSAGE "DragEnter" VIEW-AS ALERT-BOX.
END PROCEDURE.
 
one problem is solved, the next one arrives....

how would one translate this line of code to ABL ?
ListViewItem draggedItem = (ListViewItem)e.Data.GetData(typeof(ListViewItem))

I tried
DEF VAR hListViewItem AS System.Windows.Forms.ListViewItem NO-UNDO. hListViewItem = e:Data:GetData(Progress.Util.TypeHelper:GetType ("System.Windows.Forms.ListViewItem")).
but this results in a compile-error.

again thanks for your help
Wolf
 

Osborne

Active Member
I am not quite sure on this one. This compiles and if you try this does it work:

Code:
hListViewItem = CAST(e:Data:GetData(Progress.Util.TypeHelper:GetType ("System.Windows.Forms.ListViewItem")), System.Windows.Forms.ListViewItem).
 
Top