Skip to main content

Custom Message Boxes

Feature Definitions offer a powerful way to streamline your workflow and customize user input fields. You can use message boxes in CAESES to create pop-up windows that provide more information, require an action by the user or that can warn in case of critical input values. Message boxes allow validating input or computation values, or promote more conscious user interaction.

message box

General Syntax

This is the general syntax of the warning message box:

msgBoxWarning(Caption, Text, Button1 Text, Button2 Text, Button3 Text, Default Button)
SyntaxTypeDescription
CaptionFStringHeader of the message box
TextFStringMain message text of the message box
Button 1FStringText of the first button from the left
Button 2FStringText of the second button from the left
Button 3FStringText of the third button from the left. You can keep this as empty string "" to ignore this button
Default ButtonFStringUnderlined default button, which is active, when you press enter

Return Type

The return type of the command is an FUnsigned based on the selected button.

ButtonReturn Value
Button 10
Button 21
Button 32
Close (x)value of last active button

You can store the return value in an unsigned variable in order to use that in conditional statements:

FUnsigned val (msgBoxWarning(Caption,Text,Button1 Text,Button2 Text,Button3 Text,Default Button))
if(val == 0)
echo("do this")
elseif(val == 1)
echo("do that")
elseif(val == 2)
echo("do this and that")
else
echo("do nothing")
endif

Box Types

There are different box types for various scenarios:

Information Box

Example Code:

msgBoxInformation("For your Information","The feature input seems to be very good. Good Job!","Thank you","","",1)

message box

Warning Box

Example Code:

msgBoxWarning("Warning","The input value of \"Number of Blades\" seems to be very high. Do you want to continue?","Continue","Cancel","",1)

message box

Question Box

Example Code:

msgBoxWarning("Question","Is the value " + 5 +" correct?","Yes","No","",1)

message box

Critical Box

Example Code:

msgBoxCritical("Attention","Some calculations returned an unreasonable value.","Continue","Cancel","",1)

message box

Text Formatting

It is possible to format the text using HTML in order to have, e.g., a colored text. Therefore you can process the text in a function that allows reusing your formatted style:

function redText(FString text) : FString
FString res("<font color=\"red\"> " + text + "</font>")
return (res)
endfunction
msgBoxWarning("Warning",redText("The input value of \"Number of Blades\" seems to be very high. Do you want to continue?"),"Continue","Cancel","",1)

message box