Usina BRAdvPL Guide
Sign in
← All topics
COMMANDPublished

@ ... FOLDER

@ <nRow>, <nCol> FOLDER <oFolder> [OF <oWnd>] [PROMPTS <cItem,...>] [OPTION <nOption>] [SIZE <nWidth>, <nHeight>] [PIXEL]

Creates a tabbed TFolder container for organizing visual components in one interface.

Visual interfaceFolderTFolderTabsContainersCommands
01 · OVERVIEW

Overview

The @ ... FOLDER command creates a grouping component with one or more tabs. During compilation it is translated into the TFolder class New() constructor. Tabs may be declared with PROMPT, PROMPTS or ITEMS, or added later with AddItem(). Each inner area is available through oFolder:aDialogs so different controls can be created on each tab.

02 · SYNTAX

Syntax

@ <nRow>, <nCol> FOLDER <oFolder> [OF <oWnd>] [PROMPTS <cItem,...>] [OPTION <nOption>] [SIZE <nWidth>, <nHeight>] [PIXEL]

Parameters

nRow, nCol
NuméricoRequired

Row and column where the folder is placed. With PIXEL, coordinates start at the upper-left corner of the parent.

oFolder
ObjetoRequired

Variable that receives the created TFolder object.

OF oWnd
ObjetoOptional

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

PROMPT / PROMPTS / ITEMS
CaractereOptional

Tab titles. The supplied expressions are internally treated as an array.

OPTION nOption
NuméricoOptional

Number of the tab initially selected.

SIZE nWidth, nHeight
NuméricoOptional

Component width and height; define them during or after creation for correct display.

COLOR nClrText
NuméricoOptional

Text color used by the component.

MESSAGE cMsg
CaractereOptional

Contextual hint displayed while the pointer remains over the component.

PIXEL
CláusulaOptional

Indicates that position and size use pixel coordinates.

03 · PRACTICAL EXAMPLE

Tabs declared with PROMPTS

#Include "TOTVS.ch"

User Function ExFolderPrompts()
    Local oDlg
    Local oFolder
    Local cName := Space(40)
    Local lActive := .T.

    Define Dialog oDlg Title "Registration" ;
        From 0, 0 To 360, 620 Pixel

    @ 10, 15 Folder oFolder ;
        Prompts "General", "Preferences" ;
        Option 1 Size 270, 140 Of oDlg Pixel

    @ 15, 15 Say "Name:" Of oFolder:aDialogs[1] Pixel
    @ 13, 55 Get cName Size 150, 10 ;
        Of oFolder:aDialogs[1] Pixel

    @ 15, 15 CheckBox lActive Prompt "Active record" ;
        Size 100, 15 Of oFolder:aDialogs[2] Pixel

    Activate Dialog oDlg Centered
Return
Expected result

PROMPTS creates two tabs. SAY and GET belong to the first; CHECKBOX belongs to the second through aDialogs.

04 · PRACTICAL EXAMPLE

Tabs added dynamically

#Include "TOTVS.ch"

User Function ExFolderDinamico()
    Local oDlg
    Local oFolder

    Define Dialog oDlg Title "Consulta" ;
        From 0, 0 To 320, 560 Pixel

    @ 10, 15 Folder oFolder Size 240, 120 ;
        Of oDlg Pixel

    oFolder:AddItem("Resumo", .T.)
    oFolder:AddItem("Detalhes", .T.)

    @ 10, 10 Say "Visão resumida" ;
        Of oFolder:aDialogs[1] Pixel
    @ 10, 10 Say "Informações detalhadas" ;
        Of oFolder:aDialogs[2] Pixel

    oFolder:SetOption(1)
    Activate Dialog oDlg Centered
Return
Expected result

AddItem() creates tabs after the component and SetOption(1) selects the first.

BEST PRACTICES
  • Include TOTVS.ch to make the command available to the compiler.
  • With PROMPTS, tabs are created and named in the declaration.
  • Without PROMPTS, use AddItem() to add tabs dynamically.
  • Create inner controls with OF oFolder:aDialogs[nTab].
  • Use SetOption() to select a tab after creation.
  • Prefer OF to explicitly identify the parent component.
COMMON PITFALLS
  • The aDialogs index must refer to an existing tab; confirm creation order.
  • Accessing aDialogs before creating tabs produces an invalid reference.
  • Without SIZE during creation or later configuration, the folder may not display correctly.
  • Without OF, the folder is bound to the active window or dialog.
  • Mixing PIXEL with another unit may position or size the component incorrectly.
  • Too many tabs or excessive content reduces clarity; group related information and use short titles.

Related content

REFERENCES
  1. TOTVS. @ ... FOLDER. TDN. Created by Julio Wittwer; last changed on May 29, 2019.
  2. TOTVS. TFolder:New and TFolder:AddItem — class used by the command. TDN.
Status
Published
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR