PRB: DragDrop with ListView Control Fails in MouseMove Event (184206)
The information in this article applies to:
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
This article was previously published under Q184206 SYMPTOMS
In a ListView control, if you have DragMode set to vbManual and attempt to
begin DragDrop within the MouseMove event, the Drag operation will never
begin if the View property is set to either lvwIcon or lvwSmallIcon. The
Drag operation will begin successfully if the View property is set to
lvwList or lvwReport.
CAUSE
Normally, the way to initiate an ordinary DragDrop procedure is to set the
Drag property of the Listview control to vbBeginDrag. This is done by
detecting the state of the left-mouse button. If it is depressed, set the
Drag property accordingly. However, this will not work if you place your
code in the MouseMove event. When the left-mouse button is depressed, the
MouseMove button never fires, which means you can't test for the left-mouse
button's state and consequently are not able to begin the Drag operation.
This is only the case when the Listview control's View property is set to
either lvwIcon or lvwSmallIcon. If it is set to lvwList or lvwReport, the
code works as expected.
RESOLUTION
Add code to begin the Drag operation in the MouseDown event. The event is
always fired when the left-mouse button is clicked.
STATUS
Microsoft is researching this problem and will post new information here in
the Microsoft Knowledge Base as it becomes available.
Modification Type: | Major | Last Reviewed: | 11/18/2003 |
---|
Keywords: | kbprb KB184206 |
---|
|