## wxCheckListBox

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

When using this class under Windows wxWidgets must be compiled with USE_OWNER_DRAWN set to 1.

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

Please note that wxCheckListBox uses client data in its implementation, and therefore this is not available to the application.

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_TOGGLED 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")

wxCheckListBox(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices, 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.