Cloning CListCtrls

I'm looking for a example on cloning a CListCtrl. That is moving one or
more items from list A to list B so that the moved items are removed
from the source list. The following works to add the selected items to
the list.

// ----------------
    CString sItem;
    int iSel = 0;

    POSITION pos = m_cAvailImagesList.GetFirstSelectedItemPosition();

    while( pos )
    {
        iSel = m_cAvailImagesList.GetNextSelectedItem(pos);
        sItem = m_cAvailImagesList.GetItemText(iSel, 0);
        m_cUseImagesList.InsertItem(0, sItem);
    }
// --------------


Thanks.


0
1/17/2005 4:37:59 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
653 Views

Similar Articles

[PageSpeed] 4

You could use callbacks for both controls and keep your data in underlying 
collections.  Then you would just move the information from collection to 
collection and the respective list controls would just reflect that data. 
This is useful when sorting as well.  Look for LVN_GETDISPINFO.  You can 
maintain the size of the list control by simply setting the size.  You don't 
actualy have to insert the items.

Tom

"Mark F." <replytogroup@news.com> wrote in message 
news:HRRGd.23789$Ta2.13293@fe2.texas.rr.com...
> I'm looking for a example on cloning a CListCtrl. That is moving one or
> more items from list A to list B so that the moved items are removed
> from the source list. The following works to add the selected items to
> the list.
>
> // ----------------
>    CString sItem;
>    int iSel = 0;
>
>    POSITION pos = m_cAvailImagesList.GetFirstSelectedItemPosition();
>
>    while( pos )
>    {
>        iSel = m_cAvailImagesList.GetNextSelectedItem(pos);
>        sItem = m_cAvailImagesList.GetItemText(iSel, 0);
>        m_cUseImagesList.InsertItem(0, sItem);
>    }
> // --------------
>
>
> Thanks.
>
> 


0
tserface (3860)
1/17/2005 6:03:14 PM
Reply:

Similar Artilces:

Problem at drawing 256 color Icons in CListCtrl
Hi, i modify my existing code to draw 256 color icons instead of 16 color. I find here in NG some example, but it does not working correctly: The background color is always white. Can anyone give me a hint? Here is the code (i add more than one bitmap in a loop into the imagelist because more than one column contains icons, it works with 16 color icons perfectly), it is compiled under VC6: for (i = m_iImageColumnCount = 0;i < m_iColumnCount;++i) { int iStartindex = -1; if (m_viImageID[i]) { HBITMAP hBitmap = (HBITMAP)::LoadImage(::AfxGetInstanceHandle(), MAKEINTRESOURCE(m_viIma...

Cloning Austin Powers (with modifications)
Hi, Does anyone know how to do the following, for example, please? Cell A1 shows: Austin Powers, International Man of Mystery. However I'd like cell A2 to copy the information, but delete everything from the comma onwards automatically. So cell A2 should show: Austin Powers Thanks for your help, Dan. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ Dan, Try the following formula. It works regardless of whether a comma exists in A1. =IF(ISERROR(FIND(",&...

Adding items into CListCtrl
Hi, I have tried to create simple CListCtrl - Report type with two collumns. For adding columns into header I use example in CHeaderCtrl::InsertItem() in MSDN doc. It is functional. For adding items I have tried code example in CListCtrl::InsertItem() in MSDN doc. With this example items are added to my CListCtrl but all items are not visible. I only can see that after adding scroll bar changes, so items are added but items are not visible. I have tried also Update() and RedrawItems(), but no success. How can I make items visible ? Peter Peter, Presumably your list control is a "...

Memory requirement in CListCtrl
I have a CListCtrl and add items to the same. But I am observing a large (approx. 4K) memory being increased in TaskMgr. every time a message is added to the ListCtrl. I need a solution to get a way to add items to the ClistCtrl without any memory leaks. Memory usage is not the same as memory "leak". A "leak" is when allocated memory is never freed, even after the program is no longer referencing it. 4K seems like a large amount to be increasing just by adding items to a list control. i suspect other things are causing allocations during your loop, as well. &quo...

How clone a view
Hi, can anybody tell me, how can I clone a view with dmo or TSQL? Thanks What do you mean by "clone" a view? You want to create an exact copy of the view somewhere? If so, on the SQL side you might start by querying INFORMATION_SCHEMA.VIEWS. There's a column called VIEW_DEFINITION that has the exact DDL CREATE VIEW statement in it. "Thomas Hase" <tohasremspam@freenet.de> wrote in message news:gi8pk594sfo314dr49t3r0tjitfno15nhr@4ax.com... > Hi, > > can anybody tell me, how can I clone a view > with dmo or TSQL? > > Tha...

Tooltips in CTReeCtrl & CListCtrl problem
I have a VS2005 MFC dialog application with both a CTreeCtrl and CListCtrl displaying data and the user able to switch between views via the menu or toolbar button. I have added tooltips to both to show extra information from the data if the user hovers over a particular tree entry or list row. I have implemented the OnToolHitTest routine so that the TTN_NEEDTEXTW and TTN_NEEDTEXTA routines know which tree entry or list row to retrieve the appropriate data for the tooltip. Problem 1: No matter what I do (using the embedded tooltip obtained via "GetToolTips()" or creating my...

Mapping CListCtrl posion to Screen coordinates.
Hi, I am creating an SDI - application similar to desktop. In this i want to add short cut as on normal desktop. I have used CListCtrl to place the short-cut.its working fine,but i want to give facility to drag&drop the icons at the mouse-cursor posion.Also i want to retrive the corressponding posions of short-cuts on screen. Please help me. Regards Atul. See CWnd::ClientToScreen() - Harald "atul" <a_fund@yahoo.com> schrieb im Newsbeitrag news:cc80ab6.0409140152.55a9e136@posting.google.com... > Hi, > I am creating an SDI - application similar to desktop. > In ...

CListCtrl - Owner Data - Checkbox style
In my OnGetDispInfo, how do I get the checkbox to show? Currently, I only see white-space where I'd expect a checkbox (checked or unchecked) to show up. I'm using VS.NET 2003. Here's my OnGetDispInfo(...) { NMLVDISPINFO *pDispInfo = reinterpret_cast<NMLVDISPINFO*>(pNMHDR); LV_ITEM* pItem = &(pDispInfo)->item; if (pItem->mask & LVIF_TEXT) //valid text buffer? { CString str; CEINItem* pei = m_arrEINs.GetItem(pItem->iItem); switch(pItem->iSubItem) { case CEINItem::EIN: str.Format(_T(&quo...

Cloning
Maybe not the right forum, but this is my question: If I want to clone a FAT 32 disk to a preformatted NTFS new disk. Is the cloning process then automatically going to change (re-format) the preformatted NTFS system on the target disk to FAT32, or do I have to first re-format the NTFS disk to FAT 32 before cloning? P.S. I want to keep FAT32 for some MAC/PC issues. Thanks for any advise. On Fri, 9 Apr 2010 00:13:30 +0200, Erdna wrote: > Maybe not the right forum, but this is my question: > If I want to clone a FAT 32 disk to a preformatted NTFS new disk. Is the >...

How To Line Up Icons in CListCtrl
Hello I am using a CListCtrl as a Desktop.ie I add a shortcut of .exe,.txt,.doc files etc. now i want to give a facility of Line Up Icons as good as normal window does. But i am not geeting exactly how to line up the icons. please help me regards Atul ...

Cloning CListCtrls
I'm looking for a example on cloning a CListCtrl. That is moving one or more items from list A to list B so that the moved items are removed from the source list. The following works to add the selected items to the list. // ---------------- CString sItem; int iSel = 0; POSITION pos = m_cAvailImagesList.GetFirstSelectedItemPosition(); while( pos ) { iSel = m_cAvailImagesList.GetNextSelectedItem(pos); sItem = m_cAvailImagesList.GetItemText(iSel, 0); m_cUseImagesList.InsertItem(0, sItem); } // -------------- Thanks. You could use callba...

Cloning/imaging to external hard drive.
I am new to computers and I want to backup my hard drive and I've read a number of articles on how to do this but I'm not sure about some of this, I own a Dell Inspiron 1545 laptop, with a Vista Home Premium OS. I want to know which clone/external hard drive that would work with my laptop or an imaging/external hard drive. From what I have read cloning doesn't allow you to add files etc. to the ex. hard drive but imaging does, is that correct? -- padre ------------------------------------------------------------------------ padre's Profile: http://forums.techar...

CListCtrl OnVScroll never called
I have a CEdit field above the "active" field in a CListCrl, and I need a repaint of the listctrl if a user has dragged the vertical scrollbar. (when I drag the scrollbar the edit - field echoes it self over the hole page). When the mouse releases I thougt I could catch the SB_ENDSCROLL in OnVScroll() or a WM_LBUTTONUP message, but none of these events appears. Any hints to me? -- Laurs Laursen ...

HD cloned
I substituted my HD from a 160 GB Hitachi to a 640 GB WD, I made a disk-to disk copy by means of HDclone free edition, at the end it had resized authomatically the partitions, namely on the new HD the dimensions of the partitions are proportional to the corresponding ones on the old HD. Now on the old HD there was: C: NTFS, 110 GB+32 GB free space D: FAT32, recovery partition, 5,27 GB + 1GB free space and on the new HD I find: C: NTFS, 330 GB+241 GB free space D: FAT32, recovery partition, 5,27 GB + 18,5GB free space I checked C and by summing up the occupation of the first level ...

Formatted text in multiple lines in CListCtrl
I would like to know how can I display formatted text (Different fonts and colors) in multiple lines in a single cell in CListCtrl icon view. I have seen samples on codeproject/codeguru that deals with changing text color/font. But I would like to display formatted text (e.g: Some bold text and some different color in multiple lines in a single cell) along with an icon in each cell. How can I achieve this using CListCtrl? If not, can you please suggest any alternative solutions? Thanks in advance. Sounds like you need an owner-draw control. Then you can do pretty much anything you want. ...

Cloning a window
Hello, is it possible to "clone" a window, i. e., to duplicate the window handle like it is possible with file handles? If not so - is there a different way of making a copy of the window? I'd like to use this mechanism in a copy constructor for a class containing a window class. TIA! > is it possible to "clone" a window, i. e., to duplicate the > window handle like it is possible with file handles? > If not so - is there a different way of making a copy > of the window? I'd like to use this mechanism > in a copy constructor for a class containin...

Clone Drive
Hi Sbs 2003 Scsi hdd 76gb partition into (by Dell) 12gb/64gb Problem Need larger, more space, on C: drive!! Would like to clone to a NEW 76gb drive ... so parttion would be 24gb/ 56gb (.. later using old drive as a data drive) The server is 5 yrs old ... more life in her yet... do not want to over spend .. but want to clone.. as c drv(12Gb) as runing out of space.... to a new drive with 24gb partition. Have done may pc's by booting into Ghost (dos) and then just cloning drive... have seen some reports on here this may not work! So looking for some ideas. 1....

CListCtrl name-value pairs?
I've been trying to use the MFC CListCtrl to produce a name-value pair in the same way you do in html. For example I would like to show in the list box the text "somefile.mp3" and if someone selects "somefile.mp3" I would like to have set a value "c:\mp3s\somefile.mp3". Which I can use then to open the file. I noticed lparam but this only excepts integer values? I need both the text shown in the list control and it's value to be strings. Any help would be appreciated. shagy "shagy" <shagy@NOMAIL.com> wrote in message news:e82r7...

simple CListCtrl
Hello, my question is very stupid but i don't find how i can retrieve the current selected icon in a ClistCtrl ?? thanks !!! Do you mean selected item? If so, use GetNextItem(-1, LVIS_SELECTED) "Ahryman40k" <gbaudin2@wanadoo.fr> wrote in message news:br26cu$k19$1@news-reader3.wanadoo.fr... > Hello, > > my question is very stupid but i don't find how i can retrieve the current > selected icon in a ClistCtrl ?? > > thanks !!! > > Take a look at using the callback method of using a List Control. It will call your display info routine ...

Item height in CListCtrl
Is possible to set height of items in CListCtrl created without LV_OWNERDRAWFIXED style ? Peter I think you need owner drawn http://www.codeproject.com/listctrl/changerowheight.asp I don't know if this would work if you force some newlines at the end of the strings to make the rows taller... http://www.codeproject.com/listctrl/MultilineListControl.asp Tom "Peter" <Peter@discussions.microsoft.com> wrote in message news:85B91E43-9C32-4D32-9B8A-E21E9DCB9D30@microsoft.com... > Is possible to set height of items in CListCtrl created without > LV_OWNERDRAWFIXED styl...

clistctrl (columns * width) pixel limits in header ctrl of 32768
It appears that the CListCtrl in report mode has a size limitation in its header ctrl ... to calculate (in pixels) the limitation of the header ctrl I added 500 columns to a CListCtrl of width of 100 LV_COLUMN lvColumn; //initialize the columns lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvColumn.fmt = LVCFMT_LEFT; lvColumn.cx = 100; on V-scrolling over, in column 328, rendering stops for the header ctrl. 328 x 100 = 32800, ( or ~ 2^15 )... so it appears that the max pixel size for the header control is 32768 I've never run across this before because it is an ext...

Cloning FASLD
Hello, I'm working on Windows CE 5.0 and a Freescale BSP for iMX31. I want to clone public code of FASLD driver in the following directory : C:\WINCE500\COMMON\OAK\DRIVERS\BLOCK\MSFLASHFMD\FASLD I have launched sysgen_capture tool and it has generated the following sources.fasld file : !if 0 Copyright (c) Microsoft Corporation. All rights reserved. !endif !if 0 Use of this source code is subject to the terms of the Microsoft end-user license agreement (EULA) under which you licensed this SOFTWARE PRODUCT. If you did not accept the terms of the EULA, you are not authoriz...

Printing a CListCtrl
I have placed a CListCtrl on a dialog box. Please tell me, how to print it's contents?? Remember, the control is placed on a dialog box. As a report view? Extract the contents, do TextOut to get them to a page. Tedious, but straightforward. There is also a WM_PRINT message you can send, but I'm not sure it is going to produce a satisfactory result, or any result at all. joe On Tue, 16 Sep 2003 02:00:26 -0700, "Nitin" <nitinmutreja@yahoo.com> wrote: >I have placed a CListCtrl on a dialog box. >Please tell me, how to print it's contents?? > >Remem...

Formatted text in multiple lines in CListCtrl #2
I would like to know how can I display formatted text (Different fonts and colors) in multiple lines in a single cell in CListCtrl large icon view. I have seen samples on codeproject/codeguru that deals with changing text color/font. But I would like to display formatted text (e.g: Some bold text and some different color in multiple lines in a single item) along with an icon in each cell. How can I achieve this using CListCtrl? If not, can you please suggest any alternative solutions? The following article on codeproject suggests on how to change the row height in an owner drawn list control...

Cloning a bitmap
On a toolbar customization dialog, I've loaded a toolbar resource into a CBitmap, and want to extract & display a single button from within it (eventually using CStatic::SetBitmap(...)). I've tried: Getting the static's DC and a compatible memDC. Creating a compatible CBitmap to the toolbar bmp. Select the toolbar bitmap into the memDC and new bmp into the staticDC. BitBlt with SRCCOPY. Release the staticDC. but it doesn't seem to work - the new CBitmap is the correct size, but all black, while the original bitmap contains a temporary GDI object of the button. Thus...