Solved

Drag cursor for CListCtrl & CTreeCtrl

Posted on 1997-06-24
4
952 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tab names are off by one 5 54
List out all word 7 296
ShiftLeft challenge 21 82
Capture logon name 13 74
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

832 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