Source Code – lblHyperlink – Subclassed from lblLabel

Source code for the lblHyperlink class, based on the lblLabel subclass of the Visual FoxPro Label Control.

DEFINE CLASS lblHyperlink AS lblLabel

  MousePointer = 15
  ForeColor = RGB(0,102,204)
  nForeColor = 0
  nHoverColor = 0
  Name = "lblhyperlink"

  PROCEDURE Init
    DODEFAULT()
	  
    ** Use GetSysColor to get the hyperlink color
    DECLARE INTEGER GetSysColor IN "user32" INTEGER nIndex
    This.nForeColor = GetSysColor(26)	&& COLOR_HOTLIGHT
    This.nHoverColor = GetSysColor(29)  && MENU_HOTLIGHT
  ENDPROC

  PROCEDURE MouseEnter
    LPARAMETERS nButton, nShift, nXCoord, nYCoord
    WITH THIS
      .ForeColor = .nHoverColor
      .FontUnderline = .T.
      .Caption = .Caption
    ENDWITH
  ENDPROC

  PROCEDURE MouseLeave
    LPARAMETERS nButton, nShift, nXCoord, nYCoord
    WITH THIS
      .ForeColor = .nForeColor
      .FontUnderline = .F.
      .Caption = .Caption
    ENDWITH
  ENDPROC

ENDDEFINE