Hot Label Component
|Date:||14 February 2016|
TPJHotLabel is a simple Delphi component that descends from TLabel. It provides a click-able label that can start the default browser or email client to access a specific URL. Key features of the component are:
- All properties of TLabel are supported, although the usage and default values of some of the inherited properties have been changed.
- The URL property is used for storing the URL to be accessed when the label is clicked and the Caption property can either store descriptive text or can reflect the URL, depending on the value of the CaptionIsURL property. The ability to link the Caption and URL makes it easy to display the URL without having to keep two properties synchronised.
The URL can be validated to check for supported protocols. This validation
is switched on and off using the ValidateURL property. Supported
- The label's Font property defaults to a navy blue to indicate a link.
- The label can be highlighted when the mouse passes over it. Highlighting is used if the HighlightURL property is True, and the font used for highlighting is set using the HighlightFont property.
- The label can also display in a different style when its "link" has been clicked successfully. The font to be used is specified via the VistedFont property. The user can switch the visited state on and off via the Visited property or the component can be enabled to track visits automatically using the TrackVisits property.
- The label displays the "hand point" cursor by default.
The component's pop-up hints can be customised as follows, using the
the hint text can come from the Hint property as normal,
the hint text can come from the URL property with the
Hint property being ignored,
- the hint text can be modified just before the hint is shown by handling the OnCustomHint event, which is useful for displaying dynamic information in the hint.
- the hint text can come from the Hint property as normal,
The component has comprehensive online documentation.
A demo program is included in the download. See the
How it works
The component functions mainly as a standard TLabel except that:
- It handles the Delphi-specific CM_MOUSEENTER and CM_MOUSELEAVE messages to highlight the label when the mouse is over it.
- It handles Delphi's CM_HINTSHOW message to provide customised hints.
- The Caption property may automatically change when the optionally linked URL property changes.
TPJHotLabel uses the Windows ShellAPI ShellExecute function to start the default browser or email client when a URL is clicked.
Feedback & Queries
If you find any bugs or want to suggest a new feature please report them using the Issue Tracker.
Click the Create Ticket button to create a ticket then complete the
form giving as much information as possible. Please note:
this issue tracker is shared among all the projects in the DelphiDabbler
Code Library, so please make sure you enter
hotlabel in the
Project edit box. You should also choose
Defect in the
Type drop down list to report a bug or
request a new feature.
If you have created a bug fix or have implemented a new feature please attach a zip file to your ticket that contains your source code.
Should you have any queries about using the components please read the documentation.
If you can't find an answer in the documentation then post a message in the discussion group.