Solved

CListView: multi-sel dragging

Posted on 1997-11-11
3
358 Views
Last Modified: 2013-11-19
In my owner-draw CListView, when I start dragging an element (in report view), I create the drag image by:

GetListCtrl().CreateDragImage(m_nDragIndex,&point);

but the resulting drag image includes only the bitmap and not the label text.

Besides this, I need to drag a multiple selection from as CListCtrl. The documentation only refers to a single-element drag (LVN_BEGINDRAG, CreateDragImage, etc..) How can I get the dragging image of a multiple selection?

Tnx

Fabio Marzocca
0
Comment
Question by:winmeister
  • 2
3 Comments
 
LVL 8

Expert Comment

by:gelbert
ID: 1309773
When you drag more than one item then you have to use bitmap which is not associated with any of items on the list ( just keep custom bitmap in resources specially for this purpose and use it index in CreateDragImage() call). And if you really want to move text with bitmap when you do drag and drop then in OnMouseMove() or OnDraw() you have to draw/erase text near of current mouse position during drag and drop.
0
 
LVL 1

Author Comment

by:winmeister
ID: 1309774
I cannot have a custom bitmap for multi-sel, as it should be sized to the selection extension. I mean, I need to drag a multi-sel as Windows Explorer does in its right pane.

Concerning the text label, the example MFCDrag does not draw/erase text close to the mouse position, and the drag image is complete...
0
 
LVL 8

Accepted Solution

by:
gelbert earned 50 total points
ID: 1309775
 Good news is that if you can use CListCtrl::RedrawItem() to paint item(bitmap+text) when it is draged. See mfcdrag sample, file listview.cpp function OnMouseMove().
    There is no function to call to get exactly the same effect as you see Windows Explorer. So you would have to try to use RedrawItem to display drag item(s). Otherwise you have to imitate drag and drop cursor by painting Explorer-like grid by yourseft.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 83
Perl Awk Need Help 3 94
notReplace  challenge 53 102
haveThree challenge 22 100
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 discusses moving either the default database or any database to a new volume.

706 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

12 Experts available now in Live!

Get 1:1 Help Now