The Check ListBox Component

Another extension of the list box control is represented by the CheckListBox component, a list box with each item preceded by a check box (as you can see in Figure 6.5). A user can select a single item of the list, but can also click the check boxes to toggle their status. This makes the CheckListBox a very good component for multiple selections or for highlighting the status of a series of independent items (as in a series of check boxes).

To check the current status of each item, you can use the Checked and the State array properties (use the latter if the check boxes can be grayed). Delphi 5 introduced the Item-Enabled array property, which you can use to enable or disable each item of the list. We'll use the CheckListBox in the DragList example, later in this chapter.

FIGURE 6.5:

The user interface of the CheckListBox control, basically a list of check boxes

Most of the list-based controls share a common and important feature. Each item of the list has an associated 32-bit value, usually indicated by the TObject type. This value can be used as a tag for each list item, and it's very useful for storing additional information along with each item. This approach is connected to a specific feature of the native Windows list box control, which offers four bytes of extra storage for each list box item. We'll use this feature in the ODList example later on in this chapter.

Was this article helpful?

+1 -1
Self Publishing a Book The Easy Way

Self Publishing a Book The Easy Way

This comprehensive guide will present you with a variety of self-publishing options and explore their viability. Well take a look at all types of books and book-delivery systems.

Get My Free Ebook


Post a comment