So how do you get the selected item or items in CListCtrl??? for one
selected item I used the mylist.GetSelectionMark....but I have not idea
how to get the index of all the selected items. Let's assume that user
can only items that are consective to each other. That is the user
cannot select item with index 0 and 3 at the same time.
Also, if I want to delete all the selected items after I got the index
of all the item in the list, how do I do that??
Thanks in Advance. Any help will be greatly apprecitated.
leesze..
********************************************************
*As Imagination Bodies Forth
*The Forms Of Things Unknown, The Poet's Pen
*Turns Them To Shapes, And Gives To Airy
Nothing
*A Local Habitation And A Name
*
********************************************************
lee...@vse.seisea.com.sg wrote in message
<37549ECC...@vse.seisea.com.sg>...
regards,
sathish
<lee...@vse.seisea.com.sg> wrote in message
news:37549ECC...@vse.seisea.com.sg...
>Hi all,
> think my previous question was not too clear.
>
>So how do you get the selected item or items in CListCtrl??? for one
>selected item I used the mylist.GetSelectionMark....but I have not idea
>how to get the index of all the selected items. Let's assume that user
>can only items that are consective to each other. That is the user
>cannot select item with index 0 and 3 at the same time.
Look at the function CListCtrl::GetNextItem(). If you call it with
the flags set to LVNI_SELECTED, it will find selected items for you.
Call it with nItem set to -1 to find the first item and nItem set to
the index of the previous item to find each subsequent item.
>Also, if I want to delete all the selected items after I got the index
>of all the item in the list, how do I do that??
I handle it by stuffing the indexes of the selected items into a
container, then reading them back out in reverse order and deleting
from the bottom up. This prevents the other selected items from being
reindexed after each deletion.
Chip
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
"Make it idiot-proof and someone will make a better idiot."
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Remove NO and SPAM from my email address.
int nRow = pList->GetNextItem(-1, LVNI_SELECTED);
while (nRow != -1){
nRow = pList->GetNextItem(nRow, LVNI_SELECTED);
}
Of course you'll want to do something interesting with nRow inside the
loop.
Tony
In article <37549ECC...@vse.seisea.com.sg>,
lee...@vse.seisea.com.sg wrote:
> Hi all,
> think my previous question was not too clear.
>
> So how do you get the selected item or items in CListCtrl??? for one
> selected item I used the mylist.GetSelectionMark....but I have not
idea
> how to get the index of all the selected items. Let's assume that user
> can only items that are consective to each other. That is the user
> cannot select item with index 0 and 3 at the same time.
>
> Also, if I want to delete all the selected items after I got the index
> of all the item in the list, how do I do that??
>
> Thanks in Advance. Any help will be greatly apprecitated.
>
> leesze..
> ********************************************************
> *As Imagination Bodies Forth
> *The Forms Of Things Unknown, The Poet's Pen
> *Turns Them To Shapes, And Gives To Airy
> Nothing
> *A Local Habitation And A Name
> *
> ********************************************************
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.