Usina BRAdvPL Guide
Sign in
← All topics
COMMANDUnder review

BUTTON()

@ <nLinha>, <nColuna> BUTTON <cTexto> SIZE <nLargura>, <nAltura> PIXEL OF <oObjetoRef> ACTION <expressao>

Documents the @ ... BUTTON visual command on the TOTVS page.

BUTTON()AdvPL
01 · OVERVIEW

Overview

Although the official title is BUTTON(), the documented syntax is an @ command with position, text, size, parent object and action. It is not a standalone Button() function. This variant uses BUTTON cText; the related historical site page documents a CAPTION variant that must not be mixed automatically. The example creates a dialog button whose action only records a choice and closes the window. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

@ <nLinha>, <nColuna> BUTTON <cTexto> SIZE <nLargura>, <nAltura> PIXEL OF <oObjetoRef> ACTION <expressao>

Parameters

nLinha / nColuna
NumericRequired

Control position.

cTexto
CharacterRequired

Button text.

nLargura / nAltura
NumericRequired

Pixel dimensions.

oObjetoRef
ObjectRequired

Parent object.

expressao
AnyRequired

Action on button activation.

Return value

Control-creation command; no documented confirmation return.

03 · PRACTICAL EXAMPLE

Commented example

#Include "TOTVS.ch"
User Function EdButton()
    Local oDlg
    Local nChoice := 0
    DEFINE DIALOG oDlg TITLE "Editorial test" FROM 0,0 TO 120,280 PIXEL
    // Local action: no data write.
    @ 20,20 BUTTON "Confirm" SIZE 80,20 PIXEL OF oDlg ACTION (nChoice := 1, oDlg:End())
    ACTIVATE DIALOG oDlg CENTERED
    ConOut(cValToChar(nChoice))
Return Nil
Expected result

If the button action runs, nChoice becomes 1; it starts at zero to distinguish closing without that action. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Check includes and command variant in the target release. Button appearance does not grant authorization for an operation.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. BUTTON(). TDN. Sintaxe @ ... BUTTON. Accessed on 2026-10-26.
Status
Under review
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