TURLLink

Source: source/classes/urllink.prg

Inherits from: TControl

TURLLink displays a clickable hyperlink text control. When clicked, it launches the default web browser with the specified URL. The control supports custom colors for normal, hover, and visited states, transparent backgrounds, and a custom bAction code block to override the default navigation behavior.

Key DATA Members

DATATypeDescription
cURLCharacterThe target URL to open on click
nClrInitNumericText color in the normal (unvisited) state
nClrOverNumericText color when the mouse hovers over the link
nClrVisitNumericText color after the link has been clicked (visited)
bActionBlockCustom action block overriding default URL launch

Methods

MethodDescription
New( nTop, nLeft, oWnd, lPixel, lDesign, oFont, cMsg, cURL, cToolTip, nClrInit, nClrOver, nClrVisit, lTransp )Create a new TURLLink control
ReDefine( nId, oWnd )Redefine from a dialog resource

Example: URL Link with Custom Action

#include "FiveWin.ch"

function Main()

   local oWnd, oLink

   DEFINE WINDOW oWnd TITLE "URL Link Demo" SIZE 400, 200

   @ 20, 20 URLLINK oLink ;
      TEXT "Visit FiveTech Software" ;
      URL "https://fivetechsoft.com" ;
      COLOR CLR_BLUE, CLR_RED, CLR_HGRAY ;
      TOOLTIP "Click to open website" ;
      OF oWnd

   // Override default browser launch with a custom action
   oLink:bAction := {|| MsgInfo( "Navigating to: " + oLink:cURL ) }

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also