Solved

Moving items in CListBox

Posted on 2004-08-18
5
525 Views
Last Modified: 2008-02-01
Hello;

I would like to add the ability for a user to drag items arround from within a listbox so they can manually sort/arrange a list.

Like if a CListBox contained 4 file path and locations.

-------------------
c:\file1.jpg
--------------------
c:\file2.jpg
--------------------
c:\file3.jpg
-------------------
c:\file4.jpg
-------------------

So if a user wanted they could grab the third file by mouse and drag it to the top of the list
or where-ever. So they can drag and drop it.

I read about CDragListBox and it seems that it is for moving items from one list box to another. Not moving from one location in listbox to another. But I could be wrong.

Also I have already customized my listbox to recieve files. with the use of message WM_DROP

Any comments are apreciated.
RJ
0
Comment
Question by:RJSoft
[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
  • 3
5 Comments
 
LVL 3

Author Comment

by:RJSoft
ID: 11837819
I wonder if somehow the clipboard would not help somehow?
0
 
LVL 1

Expert Comment

by:2vijay
ID: 11838178
0
 
LVL 3

Author Comment

by:RJSoft
ID: 11840545
Hello 2vijay

This is the correct answer as I stated the question.

But I am wondering if there is any way to maintain the multiple selection.

I have other functions that depend upon the listbox being able to select more than 1 item.

But in order for CDragListBox type listbox to work it can not be multiple select.

Yet I see how in Windows Explorer you can make a multiple selection and drag that selection to some other folder or something.

I am wondering if Explorer is using a CTreeCtrl or something...?

Any suggestions?

RJ

0
 
LVL 14

Accepted Solution

by:
wayside earned 500 total points
ID: 11844454
Check out this example from codeproject: http://www.codeproject.com/listctrl/dragtest.asp

It uses CListCtrl, and lets you select multiple lines and drag them with in the same control.

I don't know if you can do what you want using a list box.

The Windows Explorer uses tree controls and list controls. The equivalent MFC classes would be CTreeCtrl and CListCtrl, or possibly CTreeView and CListView.
0
 
LVL 3

Author Comment

by:RJSoft
ID: 11845871
Great article!

Thanks much wayside.
RJ
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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
Writing a parser for java language 4 91
How to split this in C++ 4 119
Unable to start eclipse ? 17 163
designing in object programming 12 105
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

749 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