Applies to: ~>2.0
These examples show how to use the OnCustomHint event of TPJHotLabel. We handle the event to display a hint containing some descriptive text along with the URL in brackets.
Drop a TPJHotLabel component on a form and create a FormCreate and a OnCustomHint event handler, completed as follows:
procedure TForm1.FormCreate(Sender: TObject);
begin
// You *could* set these properties at design time in the object inspector
// instead of setting them here
PJHotLabel1.URL := 'https://delphidabbler.com/';
PJHotLabel1.HintStyle := hsCustom;
PJHotLabel1.ShowHint := True;
end;
procedure TForm1.PJHotLabel1CustomHint(Sender: TObject; var HintStr: string);
begin
HintStr := Format('View the site''s index page (%s)', [PJHotLabel1.URL]);
end;
This example is similar to the first except we store the custom hint text in the Hint property rather than entering the text in the form unit. This keeps the form's text in the form file. Drop a TPJHotLabel component on a form and create a FormCreate and a OnCustomHint event handler as before, and complete them as follows:
procedure TForm1.FormCreate(Sender: TObject);
begin
// You *could* set these properties at design time in the object inspector
// instead of setting them here
PJHotLabel1.Hint := 'View the site''s index page (%s)';
PJHotLabel1.URL := 'https://delphidabbler.com/';
PJHotLabel1.HintStyle := hsCustom;
PJHotLabel1.ShowHint := True;
end;
procedure TForm1.PJHotLabel1CustomHint(Sender: TObject; var HintStr: string);
begin
HintStr := Format(HintStr, [PJHotLabel1.URL]);
end;