Solved

CListView: multi-sel dragging

Posted on 1997-11-11
3
390 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
[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
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Suggested Solutions

Title # Comments Views Activity
notReplace  challenge 53 152
only14 challenge 19 89
Trying to run powershell  in a batch file. How do I do this? 8 122
Increment column based of a FK 8 67
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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…
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.

737 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