Rx Check List Box

RX Library

Control Name Unit Class
RX Check List Box RxCtrls TRxCheckListBox

Description:
The TRxCheckListBox displays a scrollable list with a check box next to each item.

TRxCheckListBox is similar to TListBox, except that each item has a check box or radio button (according to the CheckKind property) next to it.

The custom component editor (a wizard) is used to modify the item list and can set all the details - Add, Delete, List, State, Checked and EnabledItem properties at design-time

Optionally, if the AutoScroll property is set to True, a horizontal scroll bar appears automatically on the control. (This is useful for placing a list of items without the list scrolling off the screen)

Note: The word (check [x]) = (tick [ü]) and the word (tick [ü]) = (check [x]).
Hence the phrase "I checked your work and I found a few mistakes..."


Property AllowGrayed
Declaration: AllowGrayed: Boolean;

This determines whether the checkbox (on the left side of the listbox) can be in unknown (or "grayed") state.

If AllowGrayed is set to True, each item has three possible states: checked, unchecked, and grayed. If AllowGrayed is set to False, each item has only two possible states: checked and unchecked.


Property AutoScroll
Declaration: AutoScroll: Boolean;

The AutoScroll is a Boolean property specifying whether the horizontal scroll bar optionally appears on the list-box control.

This is useful for displaying a large number of string items. The default value is alway set to True.


Property Checked[Index: Integer]
Declaration: Checked[Index: Integer]: Boolean;

This property identifies which items on the list are checked.

For each member of the Item List, the boolean value Checked is True if a check mark appears on the item’s check box (or radio button). Checked corresponds to the cbChecked state.

(In other words,
- Checked property True is equivalent to the RadioButton's state of cbChecked.
- Checked property False is equivalent to the RadioButton's state of cbUnchecked or cbGrayed.)


Property CheckedIndex
Declaration: CheckedIndex: Integer;

The value of the CheckedIndex property is the ordinal number (starts from 0 as the first item) of the checked item in the TRxCheckListBox when the CheckKind property is ckRadioButtons.

If no item is checked or (CheckKind = ckCheckBoxes) the value of CheckedIndex is -1.


Property CheckKind
Declaration: CheckKind: TCheckKind;

The property CheckKind determines the kind of check-marks found in the TRxCheckListBox component. These are the possible values and their meanings:

  • ckCheckBoxes - like check-boxes, allows multiple ticks on any number of items;
  • ckRadioButtons - like radio-buttons, allows one tick on any one item only.

Property EnabledItem[Index: Integer]
Declaration: EnabledItem[Index: Integer]: Boolean;

This indicates whether the items in the list are enabled (i.e. user can check and uncheck these items) or disabled (user cannot do anything with that record on the list)

For each member of the Items array, EnabledItem indicates whether this item is enabled. Any item that is disabled appears in the "disabled font style" and the associated check box cannot be changed.

The Index value is zero based (ordinal) and corresponds to the index used in the Items property. Use this property to enable or disable individual list item in a TRxCheckList component.

Note: If Index is -1, there are no items on the list.


Property State[Index: Integer]
Declaration: State[Index: Integer]: TCheckBoxState;

This indicates the state of the items on the list - whether they are checked or grayed.

For each member of the Items array, State indicates whether its check box is selected (cbChecked), deselected (cbUnchecked), or grayed (cbGrayed).

The cbChecked state corresponds to the Boolean property Checked
(In other words,
- Checked property True is equivalent to the RadioButton's state of cbChecked.
- Checked property False is equivalent to the RadioButton's state of cbUnchecked or cbGrayed.)

If CheckKind = ckRadioButtons, the user selects a radio button in the list box and any selected item is automatically unselected.


Event OnClickCheck
Declaration: OnClickCheck: TNotifyEvent;

The trigger OnClickCheck occurs when the user selects or de-selects an item’s check box.

Write an OnClickCheck event handler to implement any special processing that should occur when the user checks or unchecks an item.


Event OnGetItemWidth
Declaration: OnGetItemWidth: TGetItemWidthEvent;

This obtains the item's width.
(It should be bigger than any item or record on the list.)


Event OnStateChange
Declaration: OnStateChange: TChangeStateEvent;

If any changes are made to the control (by the user - NOT by direct manipulation of the CheckedListBox by programming), this is triggered.


Method ApplyState
Declaration:

procedure ApplyState(AState: TCheckBoxState; EnabledOnly: Boolean);

This updates the property of the CheckedListBox.

In other words,
- if the new state is ckCheckBoxes, nothing occurs, except the state is changed to ckCheckBoxes.
- if the new state is ckRadioButtons, the EnabledOnly boolean variable is used to set whether the check list box is enabled or disabled.


Index Page | About | Download
Creation Date: 4 Feb 1998 | Last Update: 16 Mar 2000