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