Listbox Drag-n-Drop

A

andrew nott

Can anyone tell the the recommended way of performing mutiple-item drag-n-drop from a MultiExtended listbox?

The problem is the ListBox selection isn't completed in the MouseDown event, when the drag starts, but in the MouseUp which follows. So neither of the following sequences behave as expected:

1) MouseDown Item 1, MouseUp, MouseDown Item 6, Drag, MouseUp

2) MouseDown Item 1, MouseUp, ShiftDown, MouseDown Item 6, Drag, MouseUp, ShiftUp.

Example 1 drags the wrong Item (1 instead of 6)
Example 2 highlights a range but only drags one item.

I tried programattically selecting and deselecting items (depending upon shift, ctrl and button combinations) but it's a lot of code, it still doesn't quite work right, and I'm just duplicating code already written into the ListBox control.

It shouldn't be this hard!
 
K

Ken Tucker [MVP]

Hi,

http://msdn.microsoft.com/library/d.../en-us/dv_vstechart/html/vbtchImpDragDrop.asp


Ken
----------------------------
Can anyone tell the the recommended way of performing mutiple-item
drag-n-drop from a MultiExtended listbox?

The problem is the ListBox selection isn't completed in the MouseDown event,
when the drag starts, but in the MouseUp which follows. So neither of the
following sequences behave as expected:

1) MouseDown Item 1, MouseUp, MouseDown Item 6, Drag, MouseUp

2) MouseDown Item 1, MouseUp, ShiftDown, MouseDown Item 6, Drag, MouseUp,
ShiftUp.

Example 1 drags the wrong Item (1 instead of 6)
Example 2 highlights a range but only drags one item.

I tried programattically selecting and deselecting items (depending upon
shift, ctrl and button combinations) but it's a lot of code, it still
doesn't quite work right, and I'm just duplicating code already written into
the ListBox control.

It shouldn't be this hard!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top