This is a new site that's currently running on alpha code. There are going to be bugs. If you discover any, please report them on the site's issues page (GitHub account required). Thanks.
Warning: Many URLs are going to change. Refer to the README file to discover which library project's documentation has been completed.
Project: Hot Label Component.
Unit: PJHotLabel.
Applies to: ~>2.0
This component provides a label that can access a user-defined URL when clicked. The URL is displayed in the default browser or email client.
In addition to the properties of TLabel, from which this component descends, additional properties for working with URLs are provided. The effect of some of TLabel’s properties is modified in TPJHotLabel.
The URL property is used for storing the URL to be accessed and the Caption property can either store descriptive text or can reflect the URL, depending on the value of the CaptionIsURL property. When the ValidateURL property is True
URLs are automatically validated, raising an exception if invalid.
The label’s Font property defaults to a font based on the parent font at the time the component is dropped on the form, but coloured navy blue. It should be noted that the Font property will not automatically reflect changes in the parent controls’s font since ParentFont defaults to False
.
The label can be highlighted when the mouse passes over it. It does this only if the HighlightURL property is True
, in which case the HighlightFont property is used when the mouse is over the label. The value of HighlightFont is, by default, based on the default font used by the Font property, but with a different colour.
From v2.2 the label can change its appearance to indicate its link has been visited. It does this when its Visited property is True
, in which case the VisitedFont property is used to set the label’s font when in its un-highlighted state. Visited is a writeable property so the user can set its value in code or in the object inspector. Further, if the TrackVisits property is True
the label will automatically set Visited to True
(and change its appearance) when the label is clicked and the URL is processed without error. The value of VisitedFont is, by default, based on the default font used by the Font property, but with a different colour.
The Cursor property defaults to crHandPoint
rather than crDefault
so that the expected “pointing hand” is displayed over a link.
Useful, customisable, pop-up hints can be displayed when the mouse cursor hovers over the label. You can either display text from the Hint property as normal, display the URL property value (useful when the URL is not displayed in the label) or customise the hint each time it is displayed. The HintStyle property is used to specify the source of the hint text. Custom hints are set up by handling the OnCustomHint event.
TPJHotLabel defines no new methods over and above those inherited from TLabel.
Property | Description |
---|---|
Caption | Specifies a text string that that may be displayed in the label. How Caption is used depends on the CaptionIsURL property. |
CaptionIsURL | Determine whether the text of the label’s URL property is assigned to the Caption property or whether Caption can be used to display descriptive text. |
Cursor | Specifies the image used to represent the mouse pointer when it passes into the region covered by the control. |
Font | Specifies the label’s font when in its normal state, i.e. when it is neither highlighted or in its visited state. |
HighlightFont | Specifies the label’s font when in its highlighted state. |
HighlightURL | Determines whether the label’s text is highlighted when the mouse passes over the control. |
Hint | Contains the text string that can appear when the user moves the mouse over the control. How Hint is used depends on the HintStyle property. |
HintStyle | Determines the source of the text displayed in the component’s hint. |
ParentFont | Determines where the control looks for its font information. |
TrackVisits [~>2.2] | Determines whether or not the label automatically displays in its visible state when the user clicks the link. |
URL | Stores the URL that is to be accessed when the label is clicked. |
Visited [~>2.2] | Determines whether or not the label is in its visited state. |
VisitedFont [~>2.2] | Specifies the label’s font when in its visited state and not highlighted. |
ValidateURL | Determines whether the URL stored in the component is validated or not. |
Event | Description |
---|---|
OnCustomHint | An event that enables the user to specify a custom hint to be displayed by the component. |