Freigeben über


CCheckListBox Class

Provides the functionality of a Windows checklist box.

class CCheckListBox : public CListBox

Remarks

A "checklist box" displays a list of items, such as filenames. Each item in the list has a check box next to it that the user can check or clear.

CCheckListBox is only for owner-drawn controls because the list contains more than text strings. At its simplest, a checklist box contains text strings and check boxes, but you do not need to have text at all. For example, you could have a list of small bitmaps with a check box next to each item.

To create your own checklist box, you must derive your own class from CCheckListBox. To derive your own class, write a constructor for the derived class, then call Create.

If you want to handle Windows notification messages sent by a list box to its parent (usually a class derived from CDialog), add a message-map entry and message-handler member function to the parent class for each message.

Each message-map entry takes the following form:

ON_Notification( id, memberFxn )

where id specifies the child window ID of the control sending the notification and memberFxn is the name of the parent member function you have written to handle the notification.

The parent's function prototype is as follows:

afx_msg void memberFxn**( );**

There is only one message-map entry that pertains specifically to CCheckListBox (but see also the message-map entries for CListBox):

  • ON_CLBN_CHKCHANGE   The user has changed the state of an item's checkbox.

If your checklist box is a default checklist box (a list of strings with the default-sized checkboxes to the left of each), you can use the default CCheckListBox::DrawItem to draw the checklist box. Otherwise, you must override the CListBox::CompareItem function and the CCheckListBox::DrawItem and CCheckListBox::MeasureItem functions.

You can create a checklist box either from a dialog template or directly in your code.

Requirements

Header: afxwin.h

See Also

Concepts

TSTCON Sample: ActiveX Control Test Container

CCheckListBox Members

CListBox Class

Hierarchy Chart

CListBox Class