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.
Applies to: ~>2.0
These examples present two possible designs for TPJHotLabel components that use text highlighting to indicate that the label is clickable.
This example uses a change in text decoration to highlight the text of the label when the mouse passes over it.
First we must enable highlighting by setting HighlightURL to
True. Then we set Font.Style to
, HighlightFont.Style to
[fsUnderline] and make HighlightFont.Color the same as Font.Color. We use a colour that is different from the standard label font to indicate the label is clickable.
Start a new application and place a TPJHotLabel component on the form. Now select the component and use the object inspector to set the following property values:
If you don’t want to use the object inspector you can double click the form to create a FormCreate event handler and enter the following code in it, which assumes the component is named PJHotLabel1:
PJHotLabel1.Font.Color := clBlue; PJHotLabel1.HighlightFont.Color := PJHotLabel1.Font.Color; PJHotLabel1.Font.Style := ; PJHotLabel1.HighlightFont.Style := [fsUnderline]; PJHotLabel1.HighlightURL := True;
Now compile and run the application and roll the mouse over the URL and see the highlighting. The un-highlighted label will display with no text decoration and it will become underlined when the mouse passes over it.
The second example uses component’s default highlighting style where un-highlighted text is navy blue and underlined and highlighted text is red and also underlined.
Start a new application and drop a TPJHotLabel component on the form. We only need to set the HighlightURL property to
True, leaving all the other properties unchanged. You can use the property inspector do this or create a FormCreate event handler and enter the following line of code, assuming the component is named PJHotLabel1:
PJHotLabel1.HighlightURL := True;
Again, run the application and move the mouse cursor over the control to see the highlighting effect.