Table of Contents

DIHtmlLabel

DIHtmlLabel is a lightweight replacement for TLabel to display HTML-formatted text with clickable text links and dynamic contents.

Overview

TDIHtmlLabel replaces TLabel to output text with simple HTML formatting like clickable links, font color, and font style. Simply use the Caption property, just as you usually do with TLabel. To format text and links, use common HTML tags and character entities.

The TDIHtmlLabel component is fully Unicode compatible and can display international characters like Cyrillic and Greek using common HTML entities: αβγ = αβγ.

Display HTML as Unicode

Display of Unicode text is the main new feature of TDIHtmlLabel. This has become possible by applying DIHtmlParser as the underlying HTML parsing engine. TDIHtmlLabel displays international Unicode characters from different languages starting as early as Win95 – provided that the applied font supports the required characters glyphs. DIHtmlLabel reads Unicode by converting standard HTML entities, both named and numeric, to UnicodeStrings internally.

DIHtmlLabel Demo Application

Supported HTML Formatting

Tag recognition in DIHtmlLabel is case insensitive, just like in HTML: <B> is trated the same way as <b>. Both single (') and double () quotes are supported around attribute values, but may also be omitted.

Basic Text Formatting

<B> Bold Text Style
<FONT color=red> Colored Text Style: Named and hex (#01AFaf) color values are recognized.
<I> Italic Text Style
<S> Strike-through Text Style
<U> Underlined Text Style

Line and Paragraph Breaks

<BR> Line Break (no end tag required)
<P> Paragraph Break (no end tag required)

Special Features

<A href=“MyLink”> Hypertext Links. The OnLinkClick event handler fires, making it easy for you to perform any action you want.
<DYNAMIC id=“MyTag”> Dynamic content may not be known when you design the form, or content that changes during the course of time, such as a label reporting memory usage.

Requirements

DIHtmlLabel includes full source code for the component and demo application. To compile, DIHtmlParser is required for the low level HTML reading and parsing.

DIHtmlParser is available as a separate package on this site, so make sure to download it before you recompile the demo application or write your own.