CListCtrl::GetCheck BOOL GetCheck( int nItem ) const;Return ValueNonzero if the item is selected, otherwise 0.
// The pointer to my list view control. extern CListCtrl* pmyListCtrl;int nCount = pmyListCtrl->GetItemCount(); BOOL fCheck = FALSE;// Set the check state of every other item to TRUE and // all others to FALSE. for (int i=0;i < nCount;i++) { pmyListCtrl->SetCheck(i, fCheck); ASSERT((pmyListCtrl->GetCheck(i) && fCheck) || (!pmyListCtrl->GetCheck(i) && !fCheck)); fCheck = !fCheck; }
BOOL GetCheck( int nItem ) const;Return ValueNonzero if the item is selected, otherwise 0.
extern CListCtrl* pmyListCtrl;int nCount = pmyListCtrl->GetItemCount();
BOOL fCheck = FALSE;// Set the check state of every other item to TRUE and
// all others to FALSE.
for (int i=0;i < nCount;i++)
{
pmyListCtrl->SetCheck(i, fCheck);
ASSERT((pmyListCtrl->GetCheck(i) && fCheck) ||
(!pmyListCtrl->GetCheck(i) && !fCheck));
fCheck = !fCheck;
}
感谢
问题1 主要想得到有多少个checkbox处于选取状态 解决了但
并对现在被点击checkbox的项进行编辑 还不行
被点击checkbox 所在行的数据 无法得到我用下列方法取行数,
int n_pre;
n_pre = m_list1.GetSelectionMark();
但当点击checkbox时,每次都 n_pre =-1请问如何在案点击checkbox时, 取得所在行的相关数据?
参考
for (int i=0;i < nCount;i++)
{
pmyListCtrl->SetCheck(i, fCheck);
ASSERT((pmyListCtrl->GetCheck(i) && fCheck) ||
(!pmyListCtrl->GetCheck(i) && !fCheck));
fCheck = !fCheck;
}
抱歉,可能是我说的不明白,我想要的是
现在我 被点击checkbox 所在行的数据,
比如说我点了第二行的checkbox时,我要对
第二行的某些数据进行查询
但是 第二行的数据 如何得到?现在并不是要判断checkbox是否选中 的问题,
而是某行的checkbox被点击后,取得该行数据的问题请帮忙!