PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Programmed Drag and Drop
DnDCacheData (Example)
Programmed Drag and Drop
This example presents all the procedures required to manage a programmed Drag and Drop.
// -- Initialize the target control (EDT_Find)
EDT_Find..DndTarget = dndProgram
DnDEvent("OnDrop", EDT_Find, dndDrop)
DnDEvent("OnRollover", EDT_Find, dndDragOver)
PROCÉDURE OnRollover()
// Modify the cursor to indicate the copy
IF DnDIsDataAvailable(CF_TEXT) THEN DnDCursor(dndCopy)
PROCÉDURE OnDrop()
// Allow the text copy if text
IF DnDIsDataAvailable(CF_TEXT) THEN
EDT_Find = DnDGetData(CF_TEXT)
END
//- - Initialize the PETAL1 control
FLOWER1..DndSource = dndProgram
DnDEvent("Start", "FLOWER1", dndBeginDrag)
PROCÉDURE Start()
// Associate the "Petal" data to the "Flower" data type
// Place in the buffer of Drag and Drop
DnDCacheData("Flower", "Petal")
// Force the copy mode to avoid deleting the source
DnDForce(dndCopy)
//- - Initialize the FLOWER1 control
Recipient..DndTarget = dndProgram
DnDEvent("OnDrop", "Recipient", dndDrop)
PROCÉDURE OnDrop()
Str is string
IF DnDIsDataAvailable("Flower") THEN // "Flower" data available
Str = DnDGetData("Flower") // Retrieve the data
IF Str = "Petal" THEN
Info("A petal is added to the flower")
ListAdd(LIST_Petal, "Petal")
END
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment