TMyBox

Source: source/classes/tmybox.prg

Inherits from: TControl

TMyBox is a colored group box control with a customizable title. Unlike the standard group box, TMyBox supports custom colors for the title text, title background, and border, along with optional centered title alignment and half-width rendering.

Key DATA Members

DATATypeDescription
cTitleCharacterTitle text displayed in the box header
nClrTitleTextNumericTitle text color (RGB value)
nClrTitleBackNumericTitle background fill color (RGB value)
nClrBorderNumericBorder line color (RGB value)
lTitleCenterLogicalCenter the title text horizontally on the box
lHalfWidthLogicalRender the box at half the specified width

Methods

MethodDescription
New( oWnd, nT, nL, nH, nW, cTitle, nClrTT, nClrTB, nClrB )Create a new colored group box with optional color values
ReDefine( nId, oWnd, cTitle )Redefine from a dialog resource by control ID
SetTitle( c )Change the title text at runtime
Paint()Draw the box border, title background, and title text

Commands

@ nRow, nCol MYBOX oBox TITLE cText SIZE nW, nH OF oDlg

Example: Blue-Titled Box

#include "FiveWin.ch"

function Main()

   local oWnd, oBox

   DEFINE WINDOW oWnd TITLE "TMyBox Demo" SIZE 400, 300

   @ 20, 20 MYBOX oBox TITLE "Customer Info" ;
      SIZE 360, 150 OF oWnd

   oBox:nClrTitleText := CLR_WHITE
   oBox:nClrTitleBack := CLR_BLUE
   oBox:nClrBorder    := CLR_BLUE
   oBox:lTitleCenter  := .T.

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also