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)
PROCEDURE OnDragOver() // Modify the cursor to indicate the copy IF DnDIsDataAvailable(CF_TEXT) THEN DnDCursor(dndCopy)
PROCEDURE 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)
PROCEDURE 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)
PROCEDURE 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
This page is also available for…
|
|
|
|