Listview selected item index ??
-
How can I find the selected item index in listview??? suppose I have number of items in my list view and I have select five or six items randomly then how can I find the index of that selected items and subitems?
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
How can I find the selected item index in listview??? suppose I have number of items in my list view and I have select five or six items randomly then how can I find the index of that selected items and subitems?
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
How can I find the selected item index in listview??? suppose I have number of items in my list view and I have select five or six items randomly then how can I find the index of that selected items and subitems?
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
I make it so:
void CMyListView::OnItemchangedRulelist(NMHDR* pNMHDR, LRESULT* pResult)
{ NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;POSITION pos = m\_clcList.GetFirstSelectedItemPosition(); while (pos) { int nPos = m\_clcList.GetNextSelectedItem(pos); //nPos is the inde**x** of the selected line,make what you want } \*pResult = 0; return;
}
Edit: I forgot to say that the list im using is one of the extended lists here in codeproject (i don't remember which one :doh:)
Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
-
Hi, Enumerate through the items and test each one;
CListCtrl &ctrl = GetListCtrl();
for (int j = 0; j < nCount; j ++)
{
if (ctrl.GetItemState(j, LVIS_SELECTED) == LVIS_SELECTED)) {
// selected
}
}-- ===== Arman
Hi! Thanks actually i have try to do it in other way , following way, but in the array I got double values for one selected item now i will go through the steps you given. Actually i am working on win32(unicode). but its ok. Thanks
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
Hi, Enumerate through the items and test each one;
CListCtrl &ctrl = GetListCtrl();
for (int j = 0; j < nCount; j ++)
{
if (ctrl.GetItemState(j, LVIS_SELECTED) == LVIS_SELECTED)) {
// selected
}
}-- ===== Arman
Arman Z. Sahakyan wrote:
Enumerate through the items and test each one;
Maybe a bit inefficient in large lists :) There's also CListCtrl::GetFirstSelectedItemPosition()/CListCtrl::GetNextSelectedItem() (LVM_GETNEXTITEM for non-MFC) too. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Arman Z. Sahakyan wrote:
Enumerate through the items and test each one;
Maybe a bit inefficient in large lists :) There's also CListCtrl::GetFirstSelectedItemPosition()/CListCtrl::GetNextSelectedItem() (LVM_GETNEXTITEM for non-MFC) too. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Are you sure these APIs do not sequentially traverse all the elements by returning those with the specified style (e.g. selected ones)? I'm pretty sure it is so. :)
-- ===== Arman
Arman Z. Sahakyan wrote:
Are you sure these APIs do not sequentially traverse all the elements by returning those with the specified style (e.g. selected ones)?
Nope, I'm not sure! :) Never mind then! Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
I make it so:
void CMyListView::OnItemchangedRulelist(NMHDR* pNMHDR, LRESULT* pResult)
{ NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;POSITION pos = m\_clcList.GetFirstSelectedItemPosition(); while (pos) { int nPos = m\_clcList.GetNextSelectedItem(pos); //nPos is the inde**x** of the selected line,make what you want } \*pResult = 0; return;
}
Edit: I forgot to say that the list im using is one of the extended lists here in codeproject (i don't remember which one :doh:)
Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
I need for win32(unicode). not for MFC
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
Arman Z. Sahakyan wrote:
Enumerate through the items and test each one;
Maybe a bit inefficient in large lists :) There's also CListCtrl::GetFirstSelectedItemPosition()/CListCtrl::GetNextSelectedItem() (LVM_GETNEXTITEM for non-MFC) too. Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
Mark Salsbery wrote:
GetFirstSelectedItemPosition()/
What is
Equivalent
in win32????"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
Mark Salsbery wrote:
GetFirstSelectedItemPosition()/
What is
Equivalent
in win32????"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
amitmistry_petlad wrote:
What is Equivalent in win32????
LVM_GETNEXTITEM
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
I need for win32(unicode). not for MFC
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
No problem, but next time say it before, we can not read minds :P ;)
Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
:laugh: Thank you very much for your response. :rose:
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
No problem, but next time say it before, we can not read minds :P ;)
Greetings. -------- M.D.V. If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Sorry to ask you. what is M.D.V?
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India
-
Sorry to ask you. what is M.D.V?
"Success lies not in the result , But in the efforts !!!!!" Amit Mistry - petlad -Gujarat-India