Consultor Eletrônico



Kbase P82639: Sample code to achieve a drag and drop
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   30/06/2010
Status: Unverified

GOAL:

Sample code to achieve a drag and drop

GOAL:

How to handle drag and drop of files ?

FACT(s) (Environment):

Progress 9.x
OpenEdge 10.x
Windows

FIX:

The drag & drop feature was introduced in Version 9. Here is a sample code to achieve it.

DEFINE VARIABLE myEditorWidget AS CHAR VIEW-AS EDITOR SIZE 70 BY 10.
DEFINE FRAME f myEditorWidget WITH THREE-D NO-LABELS TITLE "Press Esc to terminate".

ON DROP-FILE-NOTIFY OF myEditorWidget DO:
DEFINE VARIABLE n AS INTEGER NO-UNDO.
DEFINE VARIABLE cFileName AS CHARACTER NO-UNDO.

DO n = 1 TO myEditorWidget:NUM-DROPPED-FILES:
cFileName = myEditorWidget:GET-DROPPED-FILE(n).
myEditorWidget:INSERT-STRING(cFileName + "~n").
END.
myEditorWidget:END-FILE-DROP().
END.

ENABLE ALL WITH FRAME f.
myEditorWidget:DROP-TARGET = YES.
WAIT-FOR CLOSE OF THIS-PROCEDURE.