TMyTitle

Source: source/classes/tmytitle.prg

Inherits from: TControl

TMyTitle is a custom gradient title bar control that can be placed at the top of a window or dialog. It renders a gradient-filled background (horizontal or vertical) with title text, an optional header bitmap, and a glass-like effect. It supports custom fonts, border colors, and runtime updates to the title text and bitmap.

Key DATA Members

DATATypeDescription
cTitleCharacterTitle text displayed on the gradient bar
cBitmapCharacterOptional bitmap file path or resource name
nClrForeNumericTitle text foreground color
nClrBeginNumericGradient start color (default light blue)
nClrEndNumericGradient end color (default dark blue)
lVerticalLogicalVertical gradient orientation (default horizontal)
lGlassLogicalEnable glass-style gradient effect
lBorderLogicalDraw a border around the title bar (default .T.)
nClrBorderNumericBorder color (default CLR_BLACK)
oBitmapObjectLoaded bitmap object (from file or resource)
oFontTitleObjectFont used for the title text
nOffSetXNumericHorizontal bitmap offset (default 0)
nOffSetYNumericVertical bitmap offset (default 0)

Methods

MethodDescription
New( oWnd, nTop, nLeft, nH, nW, cTitle, nClrFore, nClrBegin, nClrEnd, nStyle, oFontTitle, lVertical, lBorder, nClrBorder, lGlass, cBitmap )Create a new TMyTitle control
ReDefine( nId, oWnd, cTitle, nClrFore, nClrBegin, nClrEnd, lVertical, lBorder, nClrBorder, lGlass, cBitmap, oFontTitle )Redefine from dialog resource
SetBitmap( cBmp )Change the header bitmap at runtime (file or resource)
SetTitle( cTitle )Change the title text and refresh
SetFont( oFont )Change the title font

Example: Gradient Title Bar

#include "FiveWin.ch"

function Main()

   local oWnd, oTitle

   DEFINE WINDOW oWnd TITLE "Demo" SIZE 500, 300

   oTitle := TMyTitle():New( oWnd, 0, 0, 50, 500,;
              "My Custom Dialog", CLR_WHITE,;
              nRGB( 89, 135, 214 ), nRGB( 3, 56, 147 ),,,;
              .F., .T., CLR_BLACK, .F. )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also