Tree:onDropItem(item, to)event
This event is fired when the user drops a ListItem or TreeItem or directly on the Tree.
Parameters
item
The ListItem or TreeItem dropped on the Tree.
to
A number representing the index position in the Tree where the item was dropped.
Return value
The event returns no value.Example
--! luart-extensions
import ui
-- create a window
local win = ui.Window("Tree:onDropItem() sample", 640, 480)
local tree = ui.Tree(win, {"Item 1", "Item 2", "Item 3"})
tree.allowdrop = true
tree:center()
-- set a onDropItem() event
function tree:onDropItem(item, to)
ui.info("Item: "..item.text.."\ndropped at index: "..tostring(to), "item dropped on the Tree")
end
await win:showasync()