Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Drag cursor for CListCtrl & CTreeCtrl

Posted on 1997-06-24
4
Medium Priority
?
965 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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 lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

610 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