The information in this article applies to:
SUMMARYThe CCheckListBox check event can be handled through the undocumented CLBN_CHKCHANGE notification message. MORE INFORMATIONCCheckListBox is an MFC control based on an owner drawn ListBox control. It consists of a list of items with a check box. An item can be selected by clicking inside the check box next to the text of the item. This generates a CLBN_CHKCHANGE notification message which is sent to the parent window (usually a dialog). The notification can be handled by adding a notification handler as shown below using a parent dialog window as an example:
The notification handler for LBN_SELCHANGE is also shown to demonstrate the difference between the two notifications. If the check state of an item is set, the item is also selected (clearing the check box does not cancel the item). However, changing the selection state does not affect the check state. Since there was no macro similar to ON_LBN_SELCHANGE, ON_CONTROL was used. The behavior of the CCheckListBox was modified between Visual C++ version 5.0 and Visual C++ version 6.0. MFC in Visual C++ version 6.0 added the following method:
where nCheck has the same meaning in CCheckListBox::SetCheck:
SetSelectionCheck changes the check state of all selected items to the state of nCheck. When an item that is selected is checked in Visual C++ version 6.0, SetSelectionCheck changes the check state for all the other selected items. Keep this in mined when handling check notifications. REFERENCESQ194298 INFO: Changes Between MFC 4.22 and 6.0 Additional query words: CCheckListBox, SetSelectionCheck, CLBN_CHKCHANGE
Keywords : kbCtrl kbListBox kbMFC kbVC600 |
Last Reviewed: June 11, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |