wxRuby Documentation Home

# Wx::CheckListBox

A checklistbox is like a listbox, but allows items to be checked or
unchecked. Only the new functions for this class are documented; see
also ListBox and
ControlWithItems. As with other classes that
inherit from ControlWithItems, items inside a CheckListBox may have
item_data associated with them.

## Derived from

ListBox

Control

Window

EvtHandler

Object

## Window styles

See ListBox.

## Event handling

evt_checklistbox(id) { | event | … } | Process a EVT_COMMAND_CHECKLISTBOX_TOGGLED event,when an item in the check list box is checked or unchecked.

## See also

ListBox, Choice, ComboBox, ListCtrl,
CommandEvent

## Methods

- CheckListBox.new
- CheckListBox#check
- CheckListBox#get_checked_items
- CheckListBox#is_checked

### CheckListBox.new

CheckListBox.new(%(arg-type)Window% parent, Integer id, Point pos = DEFAULT_POSITION, Size size = DEFAULT_SIZE, Array choices = [], Integer style = 0, Validator validator = DEFAULT_VALIDATOR, String 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.
- choices An array of strings with which to initialise the control.
- style Window style. See CheckListBox.
- validator Window validator.
- name Window name.

### CheckListBox#check

check(%(arg-type)Integer% item, Boolean check = true)

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

#### Parameters

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

### CheckListBox#is_checked

Array get_checked_items()

Returns an array containing the indices of the items in the controls
that are currently checked.

### CheckListBox#is_checked

Boolean is_checked(%(arg-type)Integer% item)

Returns true if the given item is checked, false otherwise.

#### Parameters

- item Index of item whose check status is to be returned.

[This page automatically generated from the Textile source at 2023-06-09 00:45:26 +0000]