On pressing a button, I would like to move data from a 3 column CListCtrl to another 3 column CListCtrl. This is what I've done:
Inserting the item from column 1 works fine, but I can't get columns 2 and 3 to work. What am I missing??
Thanks in advance.
Code:
CListCtrl *pChoices, *pSelected;
pChoices = (CListCtrl *) GetDlgItem( IDS_CHOICES );
pSelected = (CListCtrl *) GetDlgItem( IDS_SELECTED );
CString sSerial;
LVITEM lvi;
lvi.mask = LVIF_TEXT;
POSITION p = pChoices->GetFirstSelectedItemPosition();
while (p)
{
int nSelected = pChoices->GetNextSelectedItem(p);
lvi.iItem = nSelected;
lvi.iSubItem = 0;
lvi.pszText = (LPTSTR)(LPCTSTR)(sSerial);
lvi.cchTextMax = 1024;
pChoices->GetItem(&lvi);
pSelected->InsertItem(&lvi);
lvi.iSubItem = 1;
pSelected->SetItem(&lvi);
}
Inserting the item from column 1 works fine, but I can't get columns 2 and 3 to work. What am I missing??
Thanks in advance.