TSysLink
Fonte: source/classes/tsyslink.prg
Inherits from: TControl
TSysLink wraps the Windows SysLink common control (Vista+), providing clickable hyperlinks within dialogs. Multiple links can be embedded in a single text string using HTML-style <a> tags. Links open URLs in the default browser or trigger Harbour code blocks.
Key DATA Members
| DATA | Type | Description |
|---|---|---|
cText | Character | Display text with <a> tags defining link regions |
cUrl | Character | URL opened when a link is clicked |
nLinkId | Numeric | Index of the last clicked link |
Methods
| Method | Description |
|---|---|
New( nRow, nCol, oWnd, cText, cUrl, nW, nH, lPixel, lDesign, cMsg, bWhen, bClick, lTransparent, ... ) | Create a new SysLink control |
ReDefine( nId, oWnd, cText, cUrl ) | Redefine from a dialog resource |
SetText( cText ) / GetText() | Change or retrieve the link text |
HitTest( nX, nY ) | Test which link is at the given coordinates |
GetIdealHeight( nWidth ) | Return ideal height for a given width |
SetItem( nIndex, cUrl, nState ) / GetItem( nIndex ) | Modify or query individual link items |
Commands
@ nRow, nCol SYSLINK oLink TEXT cText OF oWnd
Example: Multiple Links
#include "FiveWin.ch"
function Main()
local oWnd, oLink
DEFINE WINDOW oWnd TITLE "TSysLink Demo" SIZE 400, 200
@ 20, 20 SYSLINK oLink TEXT ;
"Visit <a href=""https://www.fivetechsoft.com"">FiveTech</a> " + ;
"and <a href=""https://github.com"">GitHub</a>" ;
OF oWnd
ACTIVATE WINDOW oWnd CENTERED
return nil
Notes
- Requires Windows Vista or later (SysLink control not available on older versions).
- Link regions are defined with
<a href="...">tags. Clicking opens the URL in the default browser. - Use
lTransparent := .T.to make the background match the parent dialog.