CheckListBox

A native list of items, each with its own checkbox.

Constructors

this
this(Widget parent)

Create a checked list box as a child of parent.

Members

Functions

addItem
int addItem(string text)

Append an item with the given text. Returns the new item's index.

clear
void clear()

Remove all items.

getItemCount
int getItemCount()

Return the number of items.

getItemText
string getItemText(int index)

Return the text of the item at index.

getPreferredSize
Size getPreferredSize()

A sensible default size for a checked list.

getSelectedIndex
int getSelectedIndex()

Return the index of the selected item, or -1 if nothing is selected.

isChecked
bool isChecked(int index)

Return whether the item at index is checked.

processNotify
bool processNotify(NMHDR* header)

Route list-view selection and check-toggle notifications to their events.

processSubclassed
bool processSubclassed(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT result)

Move focus onto the first item when the control gains focus with nothing selected, so a keyboard user starts on a navigable item. Always returns false so default processing still runs.

setChecked
void setChecked(int index, bool checked)

Set the checked state of the item at index.

setSelectedIndex
void setSelectedIndex(int index)

Select (and focus) the item at index.

Variables

onItemChecked
Event!(int) onItemChecked;

Fired when an item's checkbox is toggled; argument is the item index.

onSelectionChanged
Event!(int) onSelectionChanged;

Fired when the selected item changes; argument is the new selected index.

Inherited Members

From Control

controlId
int controlId()

The control's command identifier (the hMenu child id at creation).

setText
void setText(string text)

Set the control's text.

getText
string getText()

Get the control's text.

setFont
void setFont(HFONT font)

Assign a font to the control and request a repaint.

getPreferredSize
Size getPreferredSize()

A reasonable default preferred size; override per control type.

processCommand
bool processCommand(ushort notificationCode)

Handle a WM_COMMAND notification routed from the parent.

processNotify
bool processNotify(NMHDR* header)

Handle a WM_NOTIFY notification routed from the parent. Return true if it was handled. The default does nothing.

subclass
void subclass()

Install a subclass window procedure so the control can intercept its own messages (for example, swallowing the Enter key in a text field). Idempotent. Subclasses override processSubclassed to do the work.

processSubclassed
bool processSubclassed(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT result)

Intercept a message while subclassed. Set result and return true to consume the message; return false to let default processing continue.

Meta