TGroup

Source: source/classes/group.prg

Inherits from: TControl

TGroup provides a group box control that visually groups related controls inside a rectangular frame with an optional label in the upper-left corner. It supports 3D etched or raised borders, transparent backgrounds, custom text and pane colors, and can host child controls. Group boxes are commonly used in dialogs to organize input fields into logical sections.

Key DATA Members

DATATypeDescription
cCaptionCharacterLabel text displayed in the upper-left corner of the group box frame.
aControlsArrayArray of child controls hosted inside the group box area.
lTransparentLogicalIf .T., the group box background is transparent, allowing the parent background to show through.
nClrTextNumericText color for the caption label (RGB value).
nClrPaneNumericBackground fill color for the group box area (RGB value).
l3DLogicalIf .T., the border is drawn with a 3D etched or raised effect. Default is .T..
cMsgCharacterMessage bar text displayed when the group box receives focus.
lDesignLogicalIf .T., the control operates in design mode, allowing child repositioning.

Methods

MethodDescription
New( nTop, nLeft, nBottom, nRight, cLabel, oWnd, lPixel, lDesign, nClrT, nClrP, cMsg, lTransparent, oFont, l3D )Create a new group box. Coordinates define the frame rectangle. cLabel is the caption text. The frame is drawn with a 3D etched border by default.
ReDefine( nId, cLabel, oWnd )Redefine a group box from a dialog resource. The control is linked to an existing Win32 group box by its control ID.
Paint()Draw the group box frame, caption, and background. Handles 3D border rendering and transparent fill.
SetCaption( cCaption )Change the group box caption text dynamically.
End()Destroy the control and remove it from the parent window.

Commands: @ ... GROUP

@ nRow, nCol GROUP oGrp ;
   PROMPT cText ;
   SIZE nW, nH ;
   [ OF oDlg ] ;
   [ COLOR nClrText, nClrPane ] ;
   [ TRANSPARENT ] ;
   [ NO3D ]

Example: Group with Label

#include "FiveWin.ch"

function Main()

   local oWnd, oGroup, cName := Space( 30 ), cEmail := Space( 50 )

   DEFINE WINDOW oWnd TITLE "TGroup Demo" SIZE 500, 300

   @ 10, 10 GROUP oGroup PROMPT "Personal Information" ;
      SIZE 460, 200 OF oWnd

   @ 30, 30 SAY "Name:"  OF oWnd SIZE 50, 12
   @ 30, 90 GET cName    OF oWnd SIZE 200, 20

   @ 60, 30 SAY "Email:" OF oWnd SIZE 50, 12
   @ 60, 90 GET cEmail   OF oWnd SIZE 300, 20

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also