Skip over navigation

Welcome to the all new DelphiDabbler website.

I hope you like it.

There are going to be bugs. Please report any you find on the website's issues page (GitHub account required). Thanks.

Click the close button and you won't see this message again.

Hot Label Component

Label component that accesses a URL when clicked

Version 2.2.1
Released 14 Feb 2016
Platforms Win32 & Win64
Framework VCL
Compatibilty Delphi 7 and later

Overview

TPJHotLabel is a simple Delphi component that descends from TLabel. It provides a clickable 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. 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 protocols are:
    • http://
    • https://
    • mailto:
    • file:
    • ftp://
  • The label's Font property defaults to 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 differently 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 HintStyle property:
    • the hint text can come from the Hint property as normal,
        or
    • the hint text can come from the URL property with the Hint property being ignored,
        or
    • 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.

A demo program is included in the download. See the Demo sub-directory.

The component functions mainly as a standard TLabel except that:

  1. It handles the Delphi-specific CM_MOUSEENTER and CM_MOUSELEAVE messages to highlight the label when the mouse is over it.
  2. It handles Delphi's CM_HINTSHOW message to provide customised hints.
  3. 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.

Get The Code

You can download the latest version of the Hot Label Component directly from SourceForge as dd-hotlabel-2.2.1.zip.

Download v2.2.1

Hot Label Component is a sub-project of the DDabLib project which is maintained in a Subversion repository. The code is developed in the trunk/projects/hotlabel branch.

Subversion users can check out the source code of the current release from the repository on SourceForge by doing:

svn checkout http://svn.code.sf.net/p/ddablib/code/tags/projects/hotlabel/release-2.2.1 codedir

where codedir is the directory where you want to checkout code. To check out other versions, simply specify a different version number.

The latest development tree can be checked out using:

 svn checkout http://svn.code.sf.net/p/ddablib/code/trunk/projects/hotlabel codedir

Check outs are read only, but you can easily contribute code: see Feedback & Queries below.

Installation

The Hot Label Component is supplied in a zip file. Before installing you need to extract all the files from the zip file, preserving the directory structure. The following files will be extracted:

  • PJHotLabel.pas – component source code.
  • PJHotLabel.dcr – component palette glyphs.
  • ReadMe.htm – read-me file.
  • ChangeLog.txt – project change log.
  • MPL-2.txt – the Mozilla Public License v2.0.
  • Documentation.URL – short-cut to the component's online documentation.

In addition to the above files you will find the source code of the demo project the Demo sub-directory.

You can now install the components into the Delphi IDE. To do this, the files PJHotLabel.pas and PJHotLabel.dcr should be added to a design time package. If you need help doing this see here.

Documentation

The Hot Label Component is comprehensively documented online here

The project's change log can be viewed on SourceForge

A read-me file (ReadMe.htm) is included in the project download.

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.

The 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 to make it clear which project you are referring to. You should also choose Defect in the Type drop down list to report a bug or Enhancement to 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 component please read the documentation. If you can't find an answer in the documentation then post a message in the discussion group.

License

The Hot Label Component is open source. It is copyright © 1999-2016 by Peter Johnson. The source code is made available under the terms of the Mozilla Public License v2.0. All relevant trademarks are acknowledged.