[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

CListView: multi-sel dragging

Posted on 1997-11-11
3
Medium Priority
?
402 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 100 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

873 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