## wxCheckListBox

A checklistbox is like a listbox, but allows items to be checked or unchecked.

This class is currently implemented under Windows and GTK. When using this class under Windows wxWindows must be compiled with USE_OWNER_DRAWN set to 1.

Only the new functions for this class are documented; see also wxListBox.

Derived from

wxListBox
wxControl
wxWindow
wxEvtHandler
wxObject

Include files

<wx/checklst.h>

Window styles

See wxListBox.

Event handling

EVT_CHECKLISTBOX(id, func) | Process a wxEVT_COMMAND_CHECKLISTBOX_TOGGLE event, when an item in the check list box is checked or unchecked.

See also

wxListBox, wxChoice, wxComboBox, wxListCtrl, wxCommandEvent

Members

wxCheckListBox::wxCheckListBox
wxCheckListBox::~wxCheckListBox
wxCheckListBox::Check
wxCheckListBox::IsChecked

### wxCheckListBox::wxCheckListBox

wxCheckListBox()

Default constructor.

wxCheckListBox(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n, const wxString choices[] = NULL, long style = 0, const wxValidator& validator = wxDefaultValidator, const wxString& name = "listBox")

Constructor, creating and showing a list box.

Parameters

parent

Parent window. Must not be NULL.

id

Window identifier. A value of -1 indicates a default value.

pos

Window position.

size

Window size. If the default size (-1, -1) is specified then the window is sized appropriately.

n

Number of strings with which to initialise the control.

choices

An array of strings with which to initialise the control.

style

Window style. See wxCheckListBox.

validator

Window validator.

name

Window name.

wxPython note: The wxCheckListBox constructor in wxPython reduces the `n` and `choices` arguments are to a single argument, which is a list of strings.

wxPerl note: In wxPerl there is just an array reference in place of `n` and `choices`.

### wxCheckListBox::~wxCheckListBox

void ~wxCheckListBox()

Destructor, destroying the list box.

### wxCheckListBox::Check

void Check(int item, bool check = TRUE)

Checks the given item. Note that calling this method doesn't result in wxEVT_COMMAND_CHECKLISTBOX_TOGGLE being emitted.

Parameters

item

Index of item to check.

check

TRUE if the item is to be checked, FALSE otherwise.

### wxCheckListBox::IsChecked

bool IsChecked(int item) const

Returns TRUE if the given item is checked, FALSE otherwise.

Parameters

item

Index of item whose check status is to be returned.