How can I disable only one or more than one box?
I made all checkboxes disabled using following code:
in msgmap of the parent dialog (you could also use reflection and put it to
CListCtrl derivative)
ON_NOTIFY(LVN_ITEMCHANGING, IDC_LISTCTRL, OnItemChanging)
and the handler itself:
void CMyDlg::OnItemChanging(NMHDR* pNMHDR, LRESULT* pResult) {
if(m_bReadOnly) {
LPNMLISTVIEW pL = (LPNMLISTVIEW)pNMHDR;
unsigned state = (pL->uOldState ^ pL->uNewState) & 0xF000;
if(state) {
*pResult = true;
return;
}
}
*pResult = false;
}
It checks the change in image attribute of any checkbox and cancels it. The
notification is also fired when the change is done programaticaly
(SetCheck), but it
cannot be cancelled. You also get item id in the structure so you can
disable checkboxes selectively.
Ivan
"gregorio" <gregori...@hsi.ch> wrote in message
news:0ad701c31af0$a9a08b50$a601...@phx.gbl...
>.
>
Ivan
"gregorio" <gregori...@hsi.ch> wrote in message
news:0b2701c31b8b$0244c010$a101...@phx.gbl...
"gregorio" <gregori...@hsi.ch> 写入邮件
news:0ad701c31af0$a9a08b50$a601...@phx.gbl...