Checkbox with hyperlink lazarus / 31-LCL ---------------------------------------------------------------------- Schmulm · 2013-11-03 11:55 Hi, I have found a markup label component for Lazarus that supports hyperlinks. But what I rather need is a checkbox with similar text formatting options. With the checkbox, users should agree to a license agreement and therefore I want to have a hyperlink in the caption of the checkbox to display the license agreement. I have already asked the developer of the label, but he told me that it is simpel to copy the required parts of the label's source code into a custom checkbox. However, I'm a beginner and I really have no clue how to do this. Can anyone of you please give me a hint how to start? Or does anyone know an existing checkbox control that with similar capabilities? The source code of the label can be found here: http://www.infintuary.org/stlabel.php Thank you for your help Schmulm ---------------------------------------------------------------------- Bart · 2013-11-03 12:23 You need to realize that when you click on the Caption (Text) of a TCheckBox, then this will check the TCheckBox (if it was unchecked, and vice versa). So it would be unwise to you the text of the TCheckBox as the actual hyperlink. A simple solution would be to place a TCheckBox with an empty caption, and place the "markup label" right next to it. B.t.w. using a TLabel as hyperlink isn't that difficult: make it's font underlined, set it's cursor to crHandoint and in it's OnClick event do: Code: [Select]  OpenUrl(MyLabel.Caption); //provided the cation is the URL. Bart ---------------------------------------------------------------------- Schmulm · 2013-11-05 16:44 Hi Bart, thank you for the explanation. Using a label next to an empty checkbox is indeed a good idea. I will try it this way. Making a whole label a hyperlink is of course not that difficult, but if only a part of the caption should be a hyperlink or if you want to have more than one link in the caption, then it becomes a bit tricky. That's why I prefer using a 3rd party component that is capable of doing this. ---------------------------------------------------------------------- Bart · 2013-11-05 20:15 And that would be easy as well: It would be something like: Code: [Select]  TUrlLabel = class(TLabel)   private     FUrl: String;   protected     procedure Click; override;   public     constructor Create(AOwner: TComponent; AUrl: String);   published     property URL: String read FUrl write FUrl;   end; { TUrlLabel } procedure TUrlLabel.Click; begin   inherited Click;   if not Assigned(OnClick) and not Assigned(Action) then OpenUrl(FUrl) end; constructor TUrlLabel.Create(AOwner: TComponent; AUrl: String); begin   inherited Create(AOwner);   Font.Style := Font.Style + [fsUnderline];   Font.Color := clBlue;   FUrl := AUrl; end; Bart