# wxCheckListBox Class Reference
[Controls]

`#include <wx/checklst.h>`

Inheritance diagram for wxCheckListBox:
[legend]

## Detailed Description

A wxCheckListBox is like a wxListBox, but allows items to be checked or unchecked.

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

## Events emitted by this class

The following event handler macros redirect the events to member function handlers 'func' with prototypes like:

void handlerFuncName(wxCommandEvent& event)
Event macros for events emitted by this class:

- EVT_CHECKLISTBOX(id, func):
  Process a `wxEVT_COMMAND_CHECKLISTBOX_TOGGLED` event, when an item in the check list box is checked or unchecked. wxCommandEvent::GetInt() will contain the index of the item that was checked or unchecked. wxCommandEvent::IsChecked() is not valid! Use wxCheckListBox::IsChecked() instead.

##

Library: wxCore

Category: Controls
Appearance:

wxMSW appearance | wxGTK appearance | wxMac appearance

See also:
  wxListBox, wxChoice, wxComboBox, wxListCtrl, wxCommandEvent

## Public Member Functions
| wxCheckListBox ()
| Default constructor.
virtual | ~wxCheckListBox ()
| Destructor, destroying the list box.
void | Check (unsigned int item, bool check=true)
| Checks the given item.
bool | IsChecked (unsigned int item) const
| Returns true if the given item is checked, false otherwise.
| wxCheckListBox (wxWindow *parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, int n=0, const wxString choices[]=NULL, long style=0, const wxValidator &validator=wxDefaultValidator, const wxString &name="listBox")
| Constructor, creating and showing a list box.
| 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.

List of all members.

## Constructor & Destructor Documentation

wxCheckListBox::wxCheckListBox | ( |  | ) |

Default constructor.

wxCheckListBox::wxCheckListBox | ( | wxWindow * | parent,
|  | wxWindowID | id,
|  | const wxPoint & | pos = `wxDefaultPosition`,
|  | const wxSize & | size = `wxDefaultSize`,
|  | int | n = `0`,
|  | 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. The value wxID_ANY indicates a default value.
  | pos | Window position. If wxDefaultPosition is specified then a default position is chosen.
  | size | Window size. If wxDefaultSize 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.

wxPerl Note: Not supported by wxPerl.

wxCheckListBox::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. The value wxID_ANY indicates a default value.
  | pos | Window position.
  | size | Window size. If wxDefaultSize is specified then the window is sized appropriately.
  | choices | An array of strings with which to initialise the control.
  | style | Window style. See wxCheckListBox.
  | validator | Window validator.
  | name | Window name.

wxPerl Note: Use an array reference for the choices parameter.

virtual wxCheckListBox::~wxCheckListBox | ( |  | ) | `[virtual]`

Destructor, destroying the list box.

## Member Function Documentation

void wxCheckListBox::Check | ( | unsigned int | item,
|  | bool | check = `true` |
| ) |  |  |

Checks the given item.

Note that calling this method does not result in a `wxEVT_COMMAND_CHECKLISTBOX_TOGGLE` event being emitted.

Parameters:

  | item | Index of item to check.
  | check | true if the item is to be checked, false otherwise.

bool wxCheckListBox::IsChecked | ( | unsigned 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.

|  | [ top ]