NOTICE: Our Community is moving. Get more information. Updated information on a New Login Process
Is it possible to drag an item into a ListView, TreeView, or List Box container using EndDrag(), when the container is empty?
As per the definition of EndDrag(item), an item can only be
dropped into logical locations (for example, a folder) in a List
box, ListView, or TreeView. It is not possible to drop an
item into an empty conatiner, but as a workaround, EndDragAt() can
be used as follows:
[-] testcase mytest() appstate
[ ] dest.SetActive() //destination folder
[ ] source.SetActive() //source folder
[ ] source.ListView1.BeginDrag(1, 1)
[ ] RECT myRect = dest.ListView1.GetRect()
[ ] dest.ListView1.EndDragAt(myRect.xPos+1,
The above testcase uses coordinates, but it calculates them on
runtime. Thus, it can be used even if the window size or any other
environmental features change.