Re: Simulating hyperlinks in Delphi

Posted by webmaster Guido on February 19, 2003

In Reply to: Using hyperlinks inside a program posted by SCFREAK on February 19, 2003

: It seems like a noobish question, but how to do use hyperlinks inside a Delphi program?

--------

1. Add a label to the form with the text that you want to display. Example:

Label1: Caption: DelphiLand

2. Let the user know that it is a hyperlink :) so change the following properties:
- Font.Color : clBlue
- Font.Style : set fsUnderline to True

3. Create an OnClick event handler for the label:

procedure TForm1.Label1Click(Sender: TObject);
var
  HTML_File: string;
begin
  HTML_File := 'http://www.festra.com/';
  ShellExecute(Handle, 'open', PChar(HTML_File),    
   nil, nil, SW_SHOW);
end; 

For an example, see DelphiLand's section "Code Snips": "Running an external application".
 


[ DelphiLand FAQ ]