Solved

Drag cursor for CListCtrl & CTreeCtrl

Posted on 1997-06-24
4
949 Views
Last Modified: 2013-11-19
I have drag & drop support implemented in a window containing both a CListCtrl and a CTreeCtrl.  Both of these are using image lists to show icons for each item.  I can drag items from one to the othe without any difficulty.

The problem I am having is that I cannot figure out how to provide the proper drag cursor for the operation.  All I get is the default drag cursor with a small empty box, an arrow, and possibly a shortcut box.  I don't know what to hook to provide this.  I thought it would have worked by default since I am using the image list and all.
0
Comment
Question by:Vance Kessler
  • 2
4 Comments
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1302274
I assume you're using CreateDragImage() to get the ghost of the dragged item. What you're probably not doing is calling SetCursor() with the appropriate cursor. You can use any cursor for your drag, but be sure to call SetCapture().

Also, catch MouseMove messages and set the cursor there too if you want to provide feedback on whether or not dropping is alllowed.

When you're done (catch LBUTTONUP), then you can set the cursor back to the original cursor and ReleaseCapture().


0
 

Author Comment

by:Vance Kessler
ID: 1302275
No I am not using CreateDragImage().  I don't know where to use it!  I have overridden OnDragOver(), OnDragEnter(), OnDragLeave(), and OnDragBegin().  These provide enough for the drag & drop to work but not enough for the correct cursor.

I tried to override WM_MOUSEMOVE in the View, but the problem is that I never get mouse move messages.  They are all going to the actual tree control or list control.
0
 

Expert Comment

by:rderaed
ID: 1302276
Type CListCtrl in the Help dialog. Have a look in the "See Also" combobox and Select the Drag and Drop
sample. Copy it on your drive and have a look. All the
mecasnism is in the sample.

After trying for 1 day the drag and drop, i Found this sample
and understood it in few minutes...

Microsoft is the best expert ;-)


0
 
LVL 15

Expert Comment

by:Tommy Hui
ID: 1302277
You should not catch WM_MOUSEMOVE in the view, because the message will only go to the window that has called SetCapture. In this case, it would be the CTreeCtrl. You can call SetCursor() and CreateDragImage from your handler of OnDragBegin().


0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 37
Change to event 1 100
unix example issues 18 70
how to split multiple lines delimiter : 8 77
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now