I would like to create a dialog window with two list views in report mode. I
would like to be able to drag objects selected from the first list view and
drop them in the second list view. How could I do this ?
Any help would be welcome!
Nicolas Mugnier a écrit:
> I would like to create a dialog window with two list views in report mode. I
> would like to be able to drag objects selected from the first list view and
> drop them in the second list view. How could I do this ?
On LVN_BEGINDRAG notification :
ImageList_Create()
ImageList_AddMasked()
ImageList_BeginDrag()
ImageList_DragEnter()
SetCapture()
On WM_MOUSEMOVE:
GetCursorPos()-WindowFromPoint() to get destination hWnd
ImageList_DragMove()
ListView_HitTest()
On WM_LBUTTONUP:
Loop on selected items (LVIS_SELECTED) and insert in destination
ListView (eventually ListView_DeleteItem() on origin ListView to move items)
ImageList_DragLeave()
ImageList_EndDrag()
ReleaseCapture()
ImageList_Destroy()
(use also a timer to scroll the destination ListView and display the
cursor ((GetKeyState( VK_CONTROL ) & 0x8000) for move or copy items)
)(ImageList_DragShowNolock(FALSE)-WM_VSCROLL-ImageList_DragShowNolock(
TRUE ))
(and see KB 214814 for similar example on Treeview)
If you are familiar with C++ templates, you might want to
consider creating a generic dragger that takes functors for
"update drag" and "end drag". It is very handy for stuff like
this. I've used it for your problem, although I just flip up
a different cursor for allowed drops instead of a bitmap. Let
me know if you want to see it.
mike
"mike" <winte...@operamail.com> a écrit dans le message de news:
MPG.192ad7aae...@msnews.microsoft.com...