Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ListBox click event with no items? 1

Status
Not open for further replies.

KempCGDR

Programmer
Jan 10, 2003
445
GB
Hi, I have the problem that the listbox's onClick event only fires when the user clicks on an item in the list, not on the box itself. I want the user to be able to move an item from one list to the other was was going to do it by having them click on the item in the first list (works fine) and then click on the list they want to move it to, but obviously I can no longer do this.

Does anyone know how to make the event fire for any clicking done in the box? Or even better, how to let the user drag an item from one to the other?
 
An empty list box will respond to a MouseDown event. That could call your OnClick event handler.

Drag and Drop is quite easy to implement. Say you are dragging and dropping from ListBox1 to ListBox2 then:

1) set DragMode in ListBox1 to dmAutomatic

2) code OnDragOver and onDragDrop event handlers for ListBox2.

Andrew
 
Thanks a lot, got the dragging working after a lot of messing around (never done that before).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top