Book Image

Delphi Cookbook

By : Daniele Teti
Book Image

Delphi Cookbook

By: Daniele Teti

Overview of this book

Table of Contents (14 chapters)
Delphi Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating a styled TListBox


As you saw in the previous recipe, it is possible to style styled controls and completely change their appearance. While in the VCL, the TListBox control is a mere wrapper over the correspondent control in the MS Windows API; in FireMonkey, the TListBox component is a completely different beast. A TListBox component contains a list of TListBoxItem, and a TListBox item is a TStyledControl descendant. This means that every single item in a TListBox component can be styled! This feature opens a huge set of new possibilities regarding the use of the control.

Getting started

In this recipe, you'll see a set of styled TListBoxItem component that when added to TListBox, changes its appearance completely. Let's say you have a listbox containing a log of events that happened in a monitored remote system. Some events are simply informative, while other events can denote a malfunction. Different kinds of events are shown with different graphics in the listbox. Here are the...