TPanel

Source: source/classes/tpanel.prg

Inherits from: TControl

TPanel is a container control that hosts child controls with support for transparency, custom background color, and an optional border. It is commonly used to group related controls visually within a dialog or window. The panel can be designed at runtime or linked to a dialog resource.

Key DATA Members

DATATypeDescription
aControlsArrayArray of child controls hosted on the panel
nOpacityNumericOpacity level from 0 (transparent) to 255 (opaque)
nClrPaneNumericBackground fill color (RGB value)

Methods

MethodDescription
New( nTop, nLeft, nBottom, nRight, oWnd, lDesign, cVar, lBorder )Create a new panel control
Redefine( nId, oWnd )Redefine from a dialog resource
Paint()Paint the panel background and border
GotFocus( hCtlLost )Handle focus arrival; forward to child controls

Example: Panel with Child Controls

#include "FiveWin.ch"

function Main()

   local oWnd, oPanel

   DEFINE WINDOW oWnd TITLE "TPanel Demo" SIZE 500, 400

   @ 20, 20 PANEL oPanel SIZE 460, 200 OF oWnd ;
      TRANSPARENT COLOR CLR_BTNFACE

   @ 30, 40 SAY "Name:" OF oPanel SIZE 40, 12
   @ 30, 90 GET ... OF oPanel SIZE 120, 20

   @ 60, 40 SAY "Email:" OF oPanel SIZE 40, 12
   @ 60, 90 GET ... OF oPanel SIZE 180, 20

   @ 100, 40 BUTTON "Save" OF oPanel SIZE 60, 25

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

See Also