nRow, nColRow and column where the component is placed. With PIXEL, coordinates start at the upper-left corner of the parent.
AdvPL Guide@ <nRow>, <nCol> CHECKBOX [<oCheckBox> VAR] <lVar> [PROMPT <cCaption>] [OF <oWnd>] [SIZE <nWidth>, <nHeight>] [PIXEL]Creates a checkbox bound to a logical variable and optionally exposes its TCheckBox object.
The @ ... CHECKBOX command visually edits a logical value: checked represents true (.T.) and unchecked represents false (.F.). During compilation it is translated into the TCheckBox class New() constructor. Use VAR when the object must be retained for later configuration or manipulation.
@ <nRow>, <nCol> CHECKBOX [<oCheckBox> VAR] <lVar> [PROMPT <cCaption>] [OF <oWnd>] [SIZE <nWidth>, <nHeight>] [PIXEL]nRow, nColRow and column where the component is placed. With PIXEL, coordinates start at the upper-left corner of the parent.
oCheckBox VARVariable receiving the TCheckBox object. When the object is supplied, VAR is required before the logical variable.
lVarLogical variable edited by the component: .T. when checked and .F. when unchecked.
PROMPT cCaptionText displayed beside the checkbox.
OF oWndDialog, panel, folder or other visual container that owns the component. OF is recommended.
SIZE nWidth, nHeightWidth and height reserved for the component.
ON CHANGE / ON CLICKAction executed when the user changes the checkbox state.
VALIDLogical expression run when focus is lost; it must return .T. to allow leaving.
WHENLogical expression determining whether the component may receive focus.
FONT · COLOR · MESSAGE · PIXELCustomize font, colors, contextual hint and coordinate system.
#Include "TOTVS.ch"
User Function ExCheckBox()
Local oDlg
Local oCheckBox
Local lActive := .F.
Define Dialog oDlg Title "Preferences" ;
From 100, 100 To 300, 440 Pixel
@ 15, 20 CheckBox oCheckBox Var lActive ;
Prompt "Active record" Size 100, 15 ;
Of oDlg Pixel
@ 50, 20 Button "Confirm" Size 55, 14 ;
Action MsgInfo(IIf(lActive, "Active", "Inactive")) ;
Of oDlg Pixel
Activate Dialog oDlg Centered
ReturnlActive starts false, is updated by the control, and is read when the user confirms.
#Include "TOTVS.ch"
User Function ExCheckEvento()
Local oDlg
Local lEnviarEmail := .T.
Define Dialog oDlg Title "Notificações" ;
From 0, 0 To 160, 360 Pixel
@ 20, 20 CheckBox lEnviarEmail ;
Prompt "Enviar confirmação por e-mail" ;
On Change AtualizarPreferencia(lEnviarEmail) ;
Size 150, 15 Of oDlg Pixel
Activate Dialog oDlg Centered
Return
Static Function AtualizarPreferencia(lEnviarEmail)
ConOut("Enviar e-mail: " + IIf(lEnviarEmail, "Sim", "Não"))
ReturnON CHANGE forwards the new logical value to a short, focused function.
© 2026 Usina.BR. Todos os direitos reservados. TOTVS, Protheus, Microsiga e seus respectivos logotipos são marcas de titularidade da TOTVS S.A. AdvPL é uma linguagem de programação desenvolvida pela TOTVS. O AdvPL Guia é um projeto independente, sem vínculo, representação, patrocínio ou afiliação com a TOTVS S.A., suas franquias ou representantes.