Usina BRAdvPL Guide
Sign in
← All topics
COMMANDPublished

@ ... MSPANEL

@ <nRow>, <nCol> MSPANEL <oPanel> [PROMPT <cPrompt>] [OF <oWnd>] [FONT <oFont>] [CENTERED] [COLORS <nClrText>, <nClrBack>] [SIZE <nWidth>, <nHeight>] [LOWERED | RAISED]

Creates a TPanel container that organizes and hosts other visual components.

Visual interfaceMSPanelTPanelContainersLayoutCommands
01 · OVERVIEW

Overview

The @ ... MSPANEL command creates a grouping panel that may be the parent of SAY, GET, BUTTON and other controls. During compilation it is translated into the TPanel class New() constructor. Unlike TGroup, which only draws a frame, the panel is a real container and establishes a new positioning area for child components.

02 · SYNTAX

Syntax

@ <nRow>, <nCol> MSPANEL <oPanel> [PROMPT <cPrompt>] [OF <oWnd>] [FONT <oFont>] [CENTERED] [COLORS <nClrText>, <nClrBack>] [SIZE <nWidth>, <nHeight>] [LOWERED | RAISED]

Parameters

nRow, nCol
NuméricoRequired

Row and column where the panel is placed inside its parent.

oPanel
ObjetoRequired

Variable that receives the created TPanel object.

PROMPT / VAR cPrompt
CaractereOptional

Title displayed in the inner panel area.

OF oWnd
ObjetoOptional

Dialog, panel or other container that owns the new panel. OF is recommended.

FONT oFont
ObjetoOptional

Different font used as the default by inner components.

CENTERED / CENTER
CláusulaOptional

Centers the panel title; by default it appears at the upper-left of the inner area.

COLOR / COLORS nClrText, nClrBack
NuméricoOptional

Text color and, optionally, panel background color.

SIZE nWidth, nHeight
NuméricoOptional

Panel width and height; define them during or after creation.

LOWERED
CláusulaOptional

Draws right and bottom borders for a lowered appearance.

RAISED
CláusulaOptional

Draws left and top borders for a raised appearance.

03 · PRACTICAL EXAMPLE

Panel as a field container

#Include "TOTVS.ch"

User Function ExMsPanel()
    Local oDlg
    Local oPanel
    Local cName := Space(40)
    Local lActive := .T.

    Define Dialog oDlg Title "Registration" ;
        From 100, 100 To 340, 600 Pixel

    @ 10, 15 MsPanel oPanel Prompt "Main data" ;
        Colors CLR_BLACK, CLR_HGRAY Size 250, 90 ;
        Of oDlg Raised

    @ 20, 15 Say "Name:" Of oPanel Pixel
    @ 18, 60 Get cName Size 150, 12 Of oPanel Pixel
    @ 50, 15 CheckBox lActive Prompt "Active record" ;
        Size 100, 15 Of oPanel Pixel

    Activate Dialog oDlg Centered
Return
Expected result

SAY, GET and CHECKBOX belong to oPanel and are positioned within its area.

04 · PRACTICAL EXAMPLE

Panels with border styles

#Include "TOTVS.ch"

User Function ExPanelBordas()
    Local oDlg
    Local oSuperior
    Local oInferior

    Define Dialog oDlg Title "Áreas da tela" ;
        From 0, 0 To 300, 520 Pixel

    @ 10, 15 MsPanel oSuperior Prompt "Resumo" ;
        Size 220, 45 Of oDlg Raised
    @ 10, 10 Say "Conteúdo em destaque" ;
        Of oSuperior Pixel

    @ 70, 15 MsPanel oInferior Prompt "Detalhes" ;
        Size 220, 55 Of oDlg Lowered
    @ 10, 10 Say "Conteúdo detalhado" ;
        Of oInferior Pixel

    Activate Dialog oDlg Centered
Return
Expected result

RAISED and LOWERED visually distinguish areas while keeping controls in their respective containers.

BEST PRACTICES
  • Include TOTVS.ch to make the command available to the compiler.
  • Create inner controls with OF oPanel so they truly belong to the panel.
  • Child coordinates are relative to the panel area.
  • Use PROMPT with CENTERED when the panel represents a named section.
  • FONT may provide the default font for child components.
  • The Align property inherited from TControl can dynamically fit the panel to its parent.
  • Prefer OF to make the visual hierarchy explicit.
COMMON PITFALLS
  • Do not confuse MSPANEL with GROUP: only the former works as a parent component.
  • Without SIZE during creation or later configuration, the panel may not display correctly.
  • Controls created with OF oDlg instead of OF oPanel do not follow the panel hierarchy and positioning.
  • Without OF, the panel is bound to the active window or dialog.
  • RAISED and LOWERED change border appearance, not content behavior.
  • Deep panel hierarchies make maintenance and positioning harder; use only required levels.

Related content

REFERENCES
  1. TOTVS. @ ... MSPANEL. TDN. Created by Julio Wittwer; last changed on May 29, 2019.
  2. TOTVS. TPanel:New — constructor used by the command. TDN.
  3. TOTVS. TControl:Align — dynamic panel alignment. TDN.
Status
Published
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR