ImageEn, unit iexLayers

TIELayer.URL

TIELayer.URL


Declaration

property URL: String;


Description

Specifies a link for the layer.

Links have the following effects:
If the user clicks a layer then OnClickLink occurs *
If the user hovers over a layer then the URL is displayed as a hover hint and the cursor changes to crHandPoint *
When saving to SVG the links will be active

* These will only occur when there are no Layer interactions or General interactions, other than miZoom, miDblClickZoom and/or miScroll

You can use Hint to customize the hover text.


Demo

Demo  Demos\LayerEditing\Layers_Text\TextLayers.dpr


Example

// Buttons to add/remove links from text layers

procedure Tfmain.btnConvertToLinkClick(Sender: TObject);
begin
  if ImageEnView1.CurrentLayer is TIETextLayer then
  begin
    ImageEnView1.CurrentLayer.URL := 'http://www.imageen.com';
    ImageEnView1.CurrentLayer.Hint := 'Visit imageen.com';
    With TIETextLayer( ImageEnView1.CurrentLayer ).Font do
      Style := Style + [fsUnderLine];
    ImageEnView1.Update();
  end;
end;

procedure Tfmain.btnRemoveLinkClick(Sender: TObject);
begin
  if ImageEnView1.CurrentLayer is TIETextLayer then
  begin
    ImageEnView1.CurrentLayer.URL := '';
    With TIETextLayer( ImageEnView1.CurrentLayer ).Font do
      Style := Style - [fsUnderLine];
    ImageEnView1.Update();
  end;
end;

procedure Tfmain.ImageEnView1ClickLink(Sender: TObject; X, Y: Integer; Index: Integer; const URL: string);
begin
  ShellExecute(Handle, nil, PChar(URL), nil,  nil, SW_SHOWNORMAL)
end;

procedure Tfmain.FormShow(Sender: TObject);
begin
  // Allow user to zoom, scroll and click links...
  ImageEnView1.MouseInteractLayers  := [];
  ImageEnView1.MouseInteractGeneral := [miZoom, miScroll];
end;


See Also

OnClickLink
Hint