Usina BRAdvPL Guide
Sign in
← All topics
CLASSPublished

BrGetDDB

BrGetDDB():New( <nTop>, <nLeft>, <nBottom>, <nRight>, ... ) --> oBrowse

Creates a data grid/browse with records in rows and information in columns.

Visual interfaceBrowseGridDataClass
01 · OVERVIEW

Overview

BrGetDDB creates a visual grid object to display records from a data area in rows and columns. In the official example, the routine opens SA1, creates the browse inside a dialog, adds columns with TCColumn and uses code blocks to customize actions such as editing and deletion.

02 · SYNTAX

Syntax

BrGetDDB():New( <nTop>, <nLeft>, <nBottom>, <nRight>, ... ) --> oBrowse

Parameters

nTop
NuméricoRequired

Top coordinate of the browse inside the container.

nLeft
NuméricoRequired

Left coordinate of the browse inside the container.

nBottom
NuméricoRequired

Bottom coordinate of the browse.

nRight
NuméricoRequired

Right coordinate of the browse.

oWnd
ObjetoOptional

Window or dialog where the component is created.

cAlias
CaractereOptional

Alias used by the browse, such as SA1 in the example.

Methods

NewCria o componente visual de grade dentro de uma janela ou diálogo.BrGetDDB():New( <nTop>, <nLeft>, <nBottom>, <nRight>, ... ) --> oBrowse
Parameters
NameFormatRequiredDescriptionNotes
nTopNuméricoRequired

Posição superior do componente.

nLeftNuméricoRequired

Posição esquerda do componente.

nBottomNuméricoRequired

Posição inferior do componente.

nRightNuméricoRequired

Posição direita do componente.

oWndObjetoOptional

Container visual, normalmente um diálogo.

cAliasCaractereOptional

Alias da tabela/área de trabalho a exibir.

Return value

oBrowse: objeto browse criado.

AddColumnAdiciona uma coluna ao browse usando um objeto TCColumn.oBrowse:AddColumn( TCColumn():New( <cTitle>, <bData>, ... ) ) -->
Parameters
NameFormatRequiredDescriptionNotes
cTitleCaractereRequired

Título exibido no cabeçalho da coluna.

bDataBloco de códigoRequired

Bloco que retorna o valor da célula, como { || SA1->A1_COD }.

03 · PRACTICAL EXAMPLE

Customer browse in a dialog

#Include "TOTVS.ch"

User Function BrGetDDB()
    Local oDlg
    Local oBrowse

    DEFINE DIALOG oDlg TITLE "Exemplo BrGetDDB" ;
        FROM 180, 180 TO 550, 700 PIXEL

    DbSelectArea("SA1")

    oBrowse := BrGetDDB():New( ;
        1, 1, 260, 184, , , , oDlg, , , , , , , , , , , , ;
        .F., "SA1", .T., , .F., , , )

    oBrowse:bCustomEditCol := {|x, y, z| U_EditLine(x, y, z)}
    oBrowse:bDelete        := {|| ConOut("bDelete")}

    oBrowse:AddColumn(TCColumn():New("Código", {|| SA1->A1_COD}, , , , "LEFT", , .F., .F., , , , .F.))
    oBrowse:AddColumn(TCColumn():New("Loja",   {|| SA1->A1_LOJA}, , , , "LEFT", , .F., .F., , , , .F.))
    oBrowse:AddColumn(TCColumn():New("Nome",   {|| SA1->A1_NOME}, , , , "LEFT", , .F., .F., , , , .F.))

    ACTIVATE DIALOG oDlg CENTERED
Return

User Function EditLine(x, y, z)
    ApMsgStop("editLine")
Return .T.
Expected result

Creates a dialog with a grid based on alias SA1 and three columns: Code, Store and Name.

BEST PRACTICES
  • Before creating the browse, select the data area with DbSelectArea() or ensure the alias is open.
  • Use TCColumn to declare which fields or expressions will be shown as columns.
  • Callbacks such as bCustomEditCol and bDelete allow behavior customization.
COMMON PITFALLS
  • Coordinates and dimensions depend on the visual container and PIXEL usage in the dialog.
  • If the alias is not open or correctly positioned, the grid will not show the expected data.
  • As a legacy/specific visual component, validate behavior in the SmartClient and release in use.

Related content

REFERENCES
  1. TOTVS. BrGetDDb. TOTVSTEC / TDN. Creates a grid object with records in rows and information in columns.
Status
Published
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha