Deleting Selected items in CListViewCtrl 
Author Message
 Deleting Selected items in CListViewCtrl

Hi,

I've a List view control (like right window of Windows
Explorer in "Details" mode) derived from CListViewCtrl. It
is with multiple selection enabled. Now I want to delete
the selected item from it. If only one item is elected, I
can delete it using DeleteItem, but I have a problem if
multiple items are selected. I've been trying very hard to
find a way to get the index of selected items so I can
remove it. But I'm not able to find any method or function
to do this. I hope I explained problem properly. SO If you
have any idea how to do this, pl. let me know.

Following is the code snippets..

class CDeleteListView : public
CWindowImpl<CDeleteListView, CListViewCtrl>  
{
......

Quote:
}

CDeleteListView m_deleteView;
m_ListViewCtrl=m_deleteView.Create
(CDeleteClips::m_hWnd,rcDelete,NULL,            
        WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT|LBS_MULTIP
LESEL |LBS_NOINTEGRALHEIGHT |LBS_NOTIFY
                        ,0,NULL);
ps: I'm using WTL.

TIA
Anand



Sun, 12 Dec 2004 23:56:16 GMT  
 Deleting Selected items in CListViewCtrl
I think I found the soln. I need to use GetItemState. Its
so simpel. Sometimes you can't see the things which so
close to you.

Anand

Quote:
>-----Original Message-----
>Hi,

>I've a List view control (like right window of Windows
>Explorer in "Details" mode) derived from CListViewCtrl.
It
>is with multiple selection enabled. Now I want to delete
>the selected item from it. If only one item is elected, I
>can delete it using DeleteItem, but I have a problem if
>multiple items are selected. I've been trying very hard
to
>find a way to get the index of selected items so I can
>remove it. But I'm not able to find any method or
function
>to do this. I hope I explained problem properly. SO If
you
>have any idea how to do this, pl. let me know.

>Following is the code snippets..

>class CDeleteListView : public
>CWindowImpl<CDeleteListView, CListViewCtrl>  
>{
>.......
>}
>CDeleteListView m_deleteView;
>m_ListViewCtrl=m_deleteView.Create
>(CDeleteClips::m_hWnd,rcDelete,NULL,                
>    WS_CHILD|WS_VISIBLE|WS_BORDER|LVS_REPORT|LBS_MULTIP
>LESEL |LBS_NOINTEGRALHEIGHT |LBS_NOTIFY
>                    ,0,NULL);
>ps: I'm using WTL.

>TIA
>Anand
>.



Mon, 13 Dec 2004 00:21:51 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Deleting multiple selected items in ListControl

2. How to get FullRowSelect to select whole row in CListViewCtrl

3. Selecting Items from a multi select list box VC++ 6.0 on W2K

4. Count selected items of CListView while selecting

5. How To: Selected Item or Items in Web Browser (in designMode)

6. Changing Font Style / Selecting and Deleting Objects

7. Selecting Menu Items Programmatically

8. Dynamically select items in ListBox

9. How do you set the selected item....

10. Listbox event when selected item changes

11. How to select an item from a TREEVIEW without click it

12. Setting the selected item in a ListView

 

 
Powered by phpBB® Forum Software