msg_show()

Displays a customizable message box with optional buttons and a callback function.

Syntax

msg_show(icon, ok_button, cancel_button, callback, wait, title, message1, message2, ...)

Parameters

Parameter Type Description
icon Number Message box icon type: `0` (None), `1` (Info), `2` (Warning), `3` (Question).
ok_button Number `1` to show OK button, `0` to hide.
cancel_button Number `1` to show Cancel button, `0` to hide.
callback String Function name (starting with `#`) to call when the dialog closes.
wait Number `1` to wait for user response, `0` to continue execution.
title String The title of the message box.
message String/Number One or more values to display as the message content.

Return Value

Examples

Show an informational message with an OK button

msg_show(1, 1, 0, "", 1, "Info", "This is an informational message");

Show a warning message with OK and Cancel buttons, waiting for response

msg_show(2, 1, 1, "", 1, "Warning", "Do you want to continue?");

Show a message with a callback function

#onMsgClose
print(.arg1);
if(.arg1 == 2, print("OK"));
if(.arg1 == 1, print("CANCEL"));
 
msg_show(3, 1, 1, "#onMsgClose", 0, "Question", "Proceed with operation?");

Show a message to abort g-code start

#OnStart
res = msg_show(3, 1, 1, "", 1, "Question", "Proceed with operation?");
if(res != 2, nan());

See also

msg()
msgerr()

msg_show()

msg_count()
msg_is_active()

msg_click_ok()
msg_click_cancel()

bubble()