Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONPublished

ApMsgYesNo

ApMsgYesNo( <cMensagem>, [cTitulo] ) --> lResposta

Shows a Yes/No question to the user and returns the choice.

InterfaceMessageConfirmationEssential functions
01 · OVERVIEW

Overview

ApMsgYesNo() is a confirmation dialog function. Use it when the routine needs an explicit user decision before continuing, such as confirming a change, deletion, processing or submission.

02 · SYNTAX

Syntax

ApMsgYesNo( <cMensagem>, [cTitulo] ) --> lResposta

Parameters

cMensagem
CaracterRequired

Pergunta ou mensagem exibida ao usuário.

cTitulo
CaracterOptional

Título da janela de confirmação.

Return value

Lógico. Retorna .T. para Sim/Confirmação e .F. para Não/Cancelamento.

03 · PRACTICAL EXAMPLE

Confirmar alteração antes de continuar

#Include "TOTVS.ch"

User Function ExApMsgYesNo()
    If ApMsgYesNo("Confirm the registration change?", "Confirmation")
        MsgInfo("Change confirmed.")
    Else
        MsgAlert("Change canceled by the user.")
    EndIf
Return
Expected result

The routine follows different paths depending on the user’s answer.

BEST PRACTICES
  • Use quando a ação depender de consentimento explícito do usuário.
  • Escreva mensagens objetivas, indicando a ação que será executada.
  • Para simples informação use MsgInfo(); para erro use MsgStop(); para alerta sem decisão use MsgAlert().
COMMON PITFALLS
  • Não use confirmação visual em jobs, automações sem interface ou processamento batch.
  • Evite perguntas ambíguas; o usuário precisa entender exatamente o que está confirmando.

Related content

REFERENCES
  1. RXM Tecnologia. 20 essential AdvPL functions every Protheus developer uses. May 2026.
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