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!

OLE dragging listbox items

Status
Not open for further replies.

chpicker

Programmer
Apr 10, 2001
1,316
Is there a way to get a listbox's individual item to do an OLE Drag/Drop? I can't seem to get it to work, it only drags the whole listbox.
 
Are you highlighting the item(s) you want to drag and drop? And is the object you're dropping onto accepting of Drag and drop? I'll give it a try and report back my findings, but I admit I haven't used drag and drop much, at least not in VFP; I did some in VB a while ago.

Dave Dardinger
 
Well, I figured out how to drag the whole box...while it would be simple enough to check the listbox for which item was selected at the time of the drag, it looks funny to be dragging the entire box when the operation only acts on the selection. I wonder if you can simply change the drag icon... but where do you find the standard OLE Drag/Drop icons used by Windows programs?
 
Well, you can put something in the OleDragPicture property of the listbox and make it anything you want; even "Hello, World!" ;-) I've seen the the actual icons somewhere in the Window's directory; perhaps Windows\system. --Dave
 
Check the Developer's Guide section that talks about Drag-Drop. As I remember, the trick is to use the MouseDown event to detect the item you are on in the list. Using the list requires a slightly different approach to drag-drop. I got it to work with a bit of playing around and the hints from the Developer's Guide.

I believe there is an example in the Sample programs too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top