Click here to Skip to main content
15,911,786 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralDesign question Pin
alex.barylski26-Oct-03 13:39
alex.barylski26-Oct-03 13:39 
GeneralRe: Design question Pin
Ravi Bhavnani26-Oct-03 13:57
professionalRavi Bhavnani26-Oct-03 13:57 
GeneralRe: Design question Pin
alex.barylski27-Oct-03 6:55
alex.barylski27-Oct-03 6:55 
GeneralCListCtrl DeleteItem Pin
Jarek G26-Oct-03 13:05
Jarek G26-Oct-03 13:05 
GeneralRe: CListCtrl DeleteItem Pin
Daniel132426-Oct-03 13:53
Daniel132426-Oct-03 13:53 
GeneralRe: CListCtrl DeleteItem Pin
Ravi Bhavnani26-Oct-03 13:54
professionalRavi Bhavnani26-Oct-03 13:54 
GeneralRe: CListCtrl DeleteItem Pin
Jarek G26-Oct-03 14:16
Jarek G26-Oct-03 14:16 
GeneralRe: CListCtrl DeleteItem Pin
Ravi Bhavnani26-Oct-03 14:39
professionalRavi Bhavnani26-Oct-03 14:39 
Try this:
// Assign the item data to each list control entry
for (long nItem=0; (nItem < m_listCtrl.GetItemCount()); nItem++)
    m_listCtrl.SetItemData (nItem, nItem);

// Get the indexes of selected items
CUIntArray selectedItems;
POSITION pos = m_listCtrl.GetFirstSelectedItemPosition();
while (pos != NULL) {
      long nIndex = m_listCtrl.GetNextSelectedItem (pos);
      selectedItems.Add (nIndex);
}

// For each selected item...
for (nItem=0; (nItem < selectedItems.GetSize(); nItem++) {

    // Find the item in the list control...
    for (long nIndex=0; (nIndex < m_listCtrl.GetItemCount(); nIndex++)
        if (m_listCtrl.GetItemData (nIndex) == selectedItems.GetAt (nItem)) {

            // And delete it
            m_listCtrl.DeleteItem (nIndex);
            break;
        }
}
/ravi

Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com

GeneralRe: CListCtrl DeleteItem Pin
Jarek G26-Oct-03 23:32
Jarek G26-Oct-03 23:32 
GeneralRe: CListCtrl DeleteItem Pin
Roger Allen27-Oct-03 2:21
Roger Allen27-Oct-03 2:21 
GeneralRe: CListCtrl DeleteItem Pin
David Crow27-Oct-03 4:46
David Crow27-Oct-03 4:46 
GeneralRe: CListCtrl DeleteItem Pin
Jarek G27-Oct-03 7:59
Jarek G27-Oct-03 7:59 
GeneralRe: CListCtrl DeleteItem Pin
Abin27-Oct-03 14:09
Abin27-Oct-03 14:09 
GeneralCPP question Pin
alex.barylski26-Oct-03 12:22
alex.barylski26-Oct-03 12:22 
GeneralRe: CPP question Pin
Steve S27-Oct-03 1:46
Steve S27-Oct-03 1:46 
GeneralRe: CPP question Pin
alex.barylski27-Oct-03 6:53
alex.barylski27-Oct-03 6:53 
GeneralRe: CPP question Pin
Roger Allen27-Oct-03 2:32
Roger Allen27-Oct-03 2:32 
GeneralRe: CPP question Pin
Steve S27-Oct-03 3:20
Steve S27-Oct-03 3:20 
GeneralRestore Window State; Pin
Bo Hunter26-Oct-03 11:46
Bo Hunter26-Oct-03 11:46 
GeneralRe: Restore Window State; Pin
Ravi Bhavnani26-Oct-03 12:25
professionalRavi Bhavnani26-Oct-03 12:25 
GeneralGetOpenFileName Pin
Anonymous26-Oct-03 11:45
Anonymous26-Oct-03 11:45 
GeneralRe: GetOpenFileName Pin
Ravi Bhavnani26-Oct-03 12:27
professionalRavi Bhavnani26-Oct-03 12:27 
GeneralRe: GetOpenFileName Pin
georgiek5026-Oct-03 13:33
georgiek5026-Oct-03 13:33 
GeneralRe: GetOpenFileName Pin
Ravi Bhavnani26-Oct-03 13:51
professionalRavi Bhavnani26-Oct-03 13:51 
GeneralRe: GetOpenFileName Pin
georgiek5026-Oct-03 14:02
georgiek5026-Oct-03 14:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.