Canvas MessageBox: Difference between revisions
Jump to navigation
Jump to search
(Missing Navigation...) |
Red Leader (talk | contribs) (Update, added in FG 3.2) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
{{ | {{Canvas Navigation}} | ||
Message boxes provide a simple way to report information and warnings or ask questions. | Message boxes provide a simple way to report information and warnings or ask questions. They were added in FlightGear 3.2, and use <code>canvas.MessageBox</code> with the Nasal scripting language, allows showing standard message boxes to the user. | ||
== Predefined Severity Levels/Icons == | == Predefined Severity Levels/Icons == | ||
Line 45: | Line 44: | ||
| [[File:Canvas-MessageBox-demo information.png|link=]] || | | [[File:Canvas-MessageBox-demo information.png|link=]] || | ||
<syntaxhighlight lang="nasal"> | <syntaxhighlight lang="nasal"> | ||
canvas.MessageBox. | canvas.MessageBox.information("Success", "The operation has successfully completed."); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|- style="vertical-align:top;" | |- style="vertical-align:top;" |
Latest revision as of 10:12, 15 March 2016
The FlightGear forum has a subforum related to: Canvas |
Message boxes provide a simple way to report information and warnings or ask questions. They were added in FlightGear 3.2, and use canvas.MessageBox
with the Nasal scripting language, allows showing standard message boxes to the user.
Predefined Severity Levels/Icons
Icon | Icon Name | Standard MessageBox | Description |
---|---|---|---|
"dialog-question" |
canvas.MessageBox.question(
<title>,
<text>,
cb = nil,
buttons = canvas.MessageBox.Yes
| canvas.MessageBox.No
); |
Ask the user a (yes/no) question. | |
"dialog-info" |
canvas.MessageBox.information(
<title>,
<text>,
cb = nil,
buttons = canvas.MessageBox.Ok
); |
Show the user some information, with only the possiblity to close the dialog. | |
"dialog-warning" |
canvas.MessageBox.warning(
<title>,
<text>,
cb = nil,
buttons = canvas.MessageBox.Ok
); |
Show the user a non critical warning, with only the possiblity to close the dialog. | |
"dialog-error" |
canvas.MessageBox.critical(
<title>,
<text>,
cb = nil,
buttons = canvas.MessageBox.Ok
); |
Notify the user of a critical error or failure, with only the possiblity to close the dialog. |
Examples
canvas.MessageBox.information("Success", "The operation has successfully completed."); | |
canvas.MessageBox.question(
"Do you want it?",
"The question is: Do you want to get a real question?.",
func(sel)
{
if( sel == canvas.MessageBox.Yes )
print("I only know that the answer is 42.");
else
print("Ok, I will not give you a real question.");
}
); | |
canvas.MessageBox.warning(
"Warning...",
"Have you read this warning? If you want it will not be shown again.",
func(sel)
{
if( sel != canvas.MessageBox.Ok )
return;
print("You have been warned. Let the games begin...");
},
canvas.MessageBox.Ok
| canvas.MessageBox.Cancel
| canvas.MessageBox.DontShowAgain
); |