nTop, nLeft, nBottom, nRightWindow coordinates. With PIXEL, they represent the pixel area used by SmartClient.
AdvPL GuideTDialog():New( <nTop>, <nLeft>, <nBottom>, <nRight>, <cTitle>, ... )Creates a dialog window to host visual components in AdvPL routines.
TDialog is a visual class used to create dialog windows in SmartClient. It works as a container for components such as SAY, GET, BUTTON, CHECKBOX, BITMAP, BROWSE, FOLDER and panels. In a typical screen, the routine creates the dialog, adds components by informing their parent object and finally calls Activate() to display the window and hand control to the interface.
TDialog():New( <nTop>, <nLeft>, <nBottom>, <nRight>, <cTitle>, ... )nTop, nLeft, nBottom, nRightWindow coordinates. With PIXEL, they represent the pixel area used by SmartClient.
cTitleTitle displayed in the window bar.
Text/background colorsColors used in the window, usually supplied through color constants available in include files.
lPixelsIndicates that the provided measures should be interpreted as pixels.
Activate()Displays the dialog. Depending on the LIB version, it may receive options such as centering and an activation block.
#Include "TOTVS.ch"
User Function ExTDialog()
Local oDlg
Local nHeight := 180
Local nWidth := 360
Local lUsePixels := .T.
Local lCentered := .T.
Local bOnStart := {|| ConOut("Dialog activated") }
oDlg := TDialog():New(0, 0, nHeight, nWidth, ;
"Screen using TDialog", , , , , , , , , lUsePixels)
oDlg:Activate(, , , lCentered, , , bOnStart)
ReturnThe dialog is created in memory and displayed centered. bOnStart is executed during activation.
#Include "TOTVS.ch"
User Function ExTDialogCampos()
Local oDlg
Local cNome := Space(40)
oDlg := TDialog():New(0, 0, 160, 380, "Cadastro rápido", , , , , , , , , .T.)
@ 20, 20 Say "Nome:" Size 40, 10 Of oDlg Pixel
@ 18, 65 Get cNome Size 140, 10 Of oDlg Pixel
@ 50, 65 Button "Confirmar" Size 65, 14 ;
Action MsgInfo("Olá, " + AllTrim(cNome)) Of oDlg Pixel
oDlg:Activate(, , , .T.)
ReturnSAY, GET and BUTTON are created as children of oDlg. When the button is clicked, the ACTION block uses the typed value.
#Include "TOTVS.ch"
User Function ExDefineDialog()
Local oDlg
Define Dialog oDlg Title "Exemplo declarativo" ;
From 0, 0 To 160, 380 Pixel
@ 25, 25 Say "Interface criada por comando" ;
Size 150, 12 Of oDlg Pixel
Activate Dialog oDlg Centered
ReturnDEFINE/ACTIVATE syntax is more declarative and is translated by the compiler into calls to the corresponding visual classes.
© 2026 Usina.BR. All rights reserved. TOTVS, Protheus, Microsiga and their respective logos are trademarks of their owners. AdvPL Guide is independent and uses limited, attributed excerpts justified by educational purposes. See the Terms of Use. Terms of Use
Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.