Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONPublished

MsgAlert

MsgAlert( <cTexto>, <cTitulo> ) --> Nil

Displays an alert message with a title, visual icon and OK button.

InterfaceMessageAlertUser experience
01 · OVERVIEW

Overview

MsgAlert() shows an alert window to communicate a situation that requires attention but does not require the user to choose between alternatives. The OK button is created automatically and execution continues after the message is closed.

02 · SYNTAX

Syntax

MsgAlert( <cTexto>, <cTitulo> ) --> Nil

Parameters

cTexto
CharacterRequired

Main text displayed in the message body.

cTitulo
CharacterOptional

Alert window title. Use a short text that identifies the message context.

Return value

Nil. The function only displays the message and waits for user confirmation.

03 · PRACTICAL EXAMPLE

Simple alert

#Include "TOTVS.ch"

User Function ExMsgAlert()
    MsgAlert("Test message", "Alert message test")
Return
Expected result

Displays an alert window with the given text and an OK button.

04 · PRACTICAL EXAMPLE

Validation with guidance message

#Include "TOTVS.ch"

User Function ExValidateMsg()
    Local nQuantity := 0

    If nQuantity <= 0
        MsgAlert("Enter a quantity greater than zero.", "Invalid quantity")
    EndIf
Return
Expected result

The message explains the problem and guides the user’s next action.

BEST PRACTICES
  • Use MsgAlert() for simple, objective and non-destructive alerts.
  • Prefer short, action-oriented messages with enough context for the user to understand the warning.
  • For neutral information, consider MsgInfo(); for errors or blocking conditions, consider MsgStop(); for confirmation, consider MsgYesNo().
COMMON PITFALLS
  • Avoid MsgAlert() inside long loops or automated processing, because it repeatedly interrupts the user experience.
  • Do not use visual messages in routines without interface, jobs, or places where SmartClient interaction is not available.
  • Do not replace structured validations with generic text; the message should explain what happened and, when possible, how to fix it.

Related content

REFERENCES
  1. Sem Preju. Main Message Functions. Rafael Gonçalves, published May 5, 2020.
  2. eADVPL Reference Guide. No author identified, created July 28, 2005, p. 30. Complementary historical reference.
  3. eADVPL Reference Guide. No author identified, created July 28, 2005. Related section: p. 30. Historical reference; syntax checked primarily against a current source.
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