Click to See Complete Forum and Search --> : ListView and Drag&Drop ?


AlionSolutions
June 15th, 2003, 05:12 AM
Hi,
I'm in some problem implementing Drag&Drop-functionality in my project.

Scenario: I built a little "explorer" using a TreeView and a ListView. Everything works well, except of Drag&Drop.

Currently i'm at simply dragging something inside the listview. But when I start a drag-operation, no drag-image appears. I called ImageList_CreateDragImage and it returned a non NULL value. For this reason I think, this might not be the problem.

Ok, to keep it short: Has anybody an idea what might went wrong ?

Or better: Does anybody know the URL of a good tutorial. Please not just a tutorial about using ListViews (got enuff of them :D ), I need something that covers the Drag&Drop functionality.

Thanx in advance

Juergen

Bengi
June 15th, 2003, 09:34 AM
mabye my articles will help you:

http://www.codeproject.com/useritems/ListView.asp
http://www.codeproject.com/useritems/TreeView.asp

AlionSolutions
June 16th, 2003, 04:38 AM
Hi Bengi,
I read your great articles on codeguru and nearly everywhere on the web. they were a great help and and a boost on experience to me. Thanx for all of them.

I found the codeproject-link yesterday using a search-engine. I didn't have the time to read it completely, but it looks like it has the information inside I need.

I will have a close look on this later on.

Thanx again

Juergen

AlionSolutions
June 17th, 2003, 04:08 AM
Hi Bengi,
ok, now I found the time to read through your article. But unfortunately it contains NO information about drag&drop. yeah, I need to search further.
Or... did I miss the part of your article where drag&drop is covered ? If so, give me some hint please.

Ok, ok, reading the treeview-article, I found a description how to drag&drop in a treeview. Hmmm I'll test if this works with listviews also. I'm a little bit sceptic, since my last attempt of porting some treeview-code to implement drag&drop in listviews resulted in the state my code is in now ;) and now it doesn't work.

in fact I found a API-call there which is missing in my prior attempt. This call is ImageList_DragEnter, which I can use for d&d in listviews also because it belongs to ImageList. I never used this call and maybe that's the reason for my prob. I will test it, and report results later....


Greetinx for now

Juergen

AlionSolutions
June 17th, 2003, 06:06 AM
A big thanx to Bengi again, the Wizzard of Tree-/ListViews ;)

The call to ImageList_DragEnter finally brought life to drag&drop in my ListView.

There's some work left, and a little problem/question on which I will start another thread at CodeGuru.

Anyway, this thing is fixed. I get a (little oversized) dragimage displayed, and I'm able to move it inside my ListView using mousemoves. That's it.

Greets and thanx

Juergen

Bengi
June 17th, 2003, 11:11 AM
no prob man =)
treeview and listview are almost identical in its behaviors and apis, just diff structures to use :)
i haven't added drag and drop to listview yet, i will, but the tree view cover it so i see u didn't had any prob :)
keep the good work.

note: the articles on code guru are not updated, in codeProject u can find much more updated versions of my articles.