BIS fnc guiMessage: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\| *((\[\[[a-zA-Z0-9_ :\\\-\/|()]+\]\],? ?)+) * \}\}" to "|seealso= $1 }}")
m (Text replacement - "BIS fnc " to "BIS_fnc_")
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{TabView
|selected= 2
|title1= {{TabView/GameTitle|tkoh}}
|content1=
{{RV|type=function
{{RV|type=function


| arma3
|game1= tkoh
|version1= 1.00


|1.00
|gr1= GUI


|gr1= GUI
|descr= Shows customized native message box to user.


| [[File:BIS fnc guiMessage.jpg|thumb|right|GUI message in {{arma3}}]] Shows customized native message box to user.
|s1= [message, header, position, isCancel, parent, pause] spawn [[BIS_fnc_guiMessage]]
{{Feature | Informative | This syntax is for {{arma3}}. For the {{tkoh}} version, see [[BIS_fnc_guiMessage TKOH]].}}


| [message, header, okButton, cancelButton, parent, useParentBox, pause)] spawn [[BIS_fnc_guiMessage]]
|p1= message: [[String]], [[Structured Text]] or [[Array]]:
* [[String]] or [[Structured Text]] - message
* [[Array]] - listbox, every item is defined as [[String]] (enabled) or [[String]] in [[Array]] (disabled)
When variable '''BIS_fnc_guiMessage_cursel''' is defined as a [[Number]], item with this index will be selected.


|p1= message: [[String]] or [[Structured Text]] - (Optional, default "") message
|p2= header: [[String]] or [[Structured Text]] - (Optional, default "") header text


|p2= header: [[String]] - (Optional) header text
|p3= position: [[Array]] - (Optional) position in format [x,y,w,h]


|p3= okButton: [[Boolean]] or [[String]] (Optional, default [[true]])
|p4= isCancel: [[Boolean]] or [[Array]] - (Optional, default [[true]]) [[true]] to display cancel button or array with button texts [okText, cancelText]
* [[Boolean]] - enable "OK" button
* [[String]] - custom text for "OK" button


|p4= cancelButton: [[Boolean]] or [[String]] - (Optional, default [[false]])
|p5= parent: [[Display]] - (Optional) parent display
* [[Boolean]] - enable "Cancel" button
* [[String]] - custom text for "Cancel" button


|p5= parent: [[Display]] - (Optional, default [[displayNull]]) parent display
|p6= pause: [[Boolean]] - (Optional) [[true]] to pause simulation when message window is open


|p6= useParentBox: [[Boolean]] - (Optional, default [[false]]) try to use control inherited from "RscMessageBox" in parent instead of creating a new one
|r1= [[Array]] - [endState, lbId]
* endState: [[Boolean]] - [[true]] when clicked OK button, [[false]] when escaped or clicked on Cancel button
* lbId: [[Number]] - (Optional, returned if listbox was used) selected listbox item
Returned only after message box is closed.


|p7= pause: [[Boolean]] - (Optional, default [[true]]) pause simulation when message box is open (no effect in multiplayer)
|x1= <sqf>["Hello World"] spawn BIS_fnc_guiMessage;</sqf>


| [[Boolean]] - [[true]] if "OK" button was pressed, otherwise false. Returned only after message box is closed.
|x2= [[File:TakeOn BIS_fnc_guiMessage.jpg|right|200px]]
<sqf>["Message", "Header", nil, true] spawn BIS_fnc_guiMessage;</sqf>


|x1= <code>["Hello World"] [[spawn]] [[BIS_fnc_guiMessage]];</code>
|x3= <sqf>[["Enabled Item", ["Disabled Item"]], "Header"] spawn BIS_fnc_guiMessage;</sqf>


|x2= <code>_result = ["Are you sure?", "Confirm", [[true]], [[true]]] [[call]] [[BIS_fnc_guiMessage]];</code>
|seealso= [[hintC]] [[BIS_fnc_GUIhint]]


|seealso= [[hintC]], [[BIS_fnc_GUIhint]] [[BIS_fnc_3DENShowMessage]]
|exec= spawn
}}
}}


<dl class="command_description">
|title2= {{TabView/GameTitle|arma3}}
<!-- Note Section BEGIN -->
|content2=
{{RV|type=function
 
|game1= arma3
|version1= 0.50
 
|eff= local
 
|gr1= GUI
 
|descr= [[File:BIS_fnc_guiMessage.jpg|thumb|[[BIS_fnc_guiMessage]] dialog in {{arma3}}]]
Displays an interactive message dialog in the center of the screen.
{{Feature|important|This function internally utilizes suspension ([[waitUntil]] to be specific) and therefore has to be executed in a [[Scheduler#Scheduled_Environment|scheduled environment]].}}
 
|exec= call
 
|s1= [message, header, okButton, cancelButton, parent, useParentBox, pause] call [[BIS_fnc_guiMessage]]
 
|p1= message: [[String]] or [[Structured Text]] - (Optional, default: "") message
 
|p2= header: [[String]] - (Optional, default: "") header text
 
|p3= okButton [[Boolean]] or [[String]] - (Optional, default [[true]]):
* [[Boolean]] - enable the "OK" button
* [[String]] - custom text for the "OK" button
 
|p4= cancelButton: [[Boolean]] or [[String]] - (Optional, default [[false]]):
* [[Boolean]] - enable the "Cancel" button
* [[String]] - custom text for the "Cancel" button
 
|p5= parent: [[Display]] - (Optional, default: <sqf inline>[] call BIS_fnc_displayMission</sqf>) parent display
 
|p6= useParentBox: [[Boolean]] - (Optional, default: [[false]]) try to use control inherited from "RscMessageBox" in parent instead of creating a new one
 
|p7= pause: [[Boolean]] - (Optional, default: [[true]]) pause simulation while message dialog is open (no effect in multiplayer)
 
|r1= [[Boolean]] - [[true]] if the "OK" button was pressed, otherwise [[false]]. Returned only after the message box is closed.
 
|x1= Because this example uses [[spawn]], the return value of [[BIS_fnc_guiMessage]] is lost and can not be used.
<sqf>["Hello World"] spawn BIS_fnc_guiMessage;</sqf>


<dd class="notedate">Posted on June 24, 2014 - 00:43 (UTC)</dd>
|x2= <sqf>
<dt class="note">[[User:AgentRevolution|AgentRev]]</dt>
private _result = ["Are you sure?", "Confirm", true, true] call BIS_fnc_guiMessage;
<dd class="note">
Message boxes can be force-closed with:
<code>[[uiNamespace]] [[setVariable]] ["BIS_fnc_guiMessage_status", [[false]]];</code>
</dd>


<dd class="notedate">Posted on January 13, 2016 - 15:16 (UTC)</dd>
if (_result) then {
<dt class="note">[[User:Eden|Eden]]</dt>
systemChat "The player is sure.";
<dd class="note">
} else {
Calling this function can cause an game crash. When doing this you have to [[spawn]] the function or add an spawn around it so you can use the result:
systemChat "The player is not sure.";
};
</sqf>


<code>[] [[spawn]]
|seealso= [[BIS_fnc_GUIhint]] [[BIS_fnc_3DENShowMessage]] [[hintC]]
{
}}
  [[private]] _result = ["Are you sure?", "Confirm", [[true]], [[true]]] [[call]] [[BIS_fnc_guiMessage]];
  {{cc|Use _result here}}
};</code>
</dd>


<dd class="notedate">Posted on November 1, 2017 - 18:35 (UTC)</dd>
}}
<dt class="note">[[User:demellion|demellion]]</dt>
<dd class="note">
'''NOTE''': This function only exists along with mission display ([[findDisplay]] 46). If this function is called before with ''-skipIntro'' parameter enabled (see [[Arma 3 Startup Parameters]]) it will result as [[Void]].
</dd>


<!-- Note Section END -->
{{Note
</dl>
|user= AgentRev
|timestamp= 20140624004300
|text= Message boxes can be force-closed with:
<sqf>uiNamespace setVariable ["BIS_fnc_guiMessage_status", false];</sqf>
}}


{{Note
|user= Eden
|timestamp= 20160113151600
|text= Calling this function can cause an game crash. When doing this you have to [[spawn]] the function or add an spawn around it so you can use the result:
<sqf>
[] spawn
{
private _result = ["Are you sure?", "Confirm", true, true] call BIS_fnc_guiMessage;
// Use _result here
};
</sqf>
}}


[[Category:Function Group: GUI|guiMessage]]
{{Note
|user= Demellion
|timestamp= 20171101183500
|text= This function only exists along with mission display ([[findDisplay]] 46). If this function is called before with ''-skipIntro'' parameter enabled (see [[Arma 3: Startup Parameters]]) it will result as [[Void]].
}}

Latest revision as of 12:15, 27 July 2022

tkoh logo small.png Take On Helicopters
Arma 3 logo black.png Arma 3
Hover & click on the images for description

Description

Description:
Shows customized native message box to user.
Execution:
spawn
Groups:
GUI

Syntax

Syntax:
[message, header, position, isCancel, parent, pause] spawn BIS_fnc_guiMessage
Parameters:
message: String, Structured Text or Array: When variable BIS_fnc_guiMessage_cursel is defined as a Number, item with this index will be selected.
header: String or Structured Text - (Optional, default "") header text
position: Array - (Optional) position in format [x,y,w,h]
isCancel: Boolean or Array - (Optional, default true) true to display cancel button or array with button texts [okText, cancelText]
parent: Display - (Optional) parent display
pause: Boolean - (Optional) true to pause simulation when message window is open
Return Value:
Array - [endState, lbId]
  • endState: Boolean - true when clicked OK button, false when escaped or clicked on Cancel button
  • lbId: Number - (Optional, returned if listbox was used) selected listbox item
Returned only after message box is closed.

Examples

Example 1:
["Hello World"] spawn BIS_fnc_guiMessage;
Example 2:
TakeOn BIS fnc guiMessage.jpg
["Message", "Header", nil, true] spawn BIS_fnc_guiMessage;
Example 3:
[["Enabled Item", ["Disabled Item"]], "Header"] spawn BIS_fnc_guiMessage;

Additional Information

See also:
hintC BIS_fnc_GUIhint

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Hover & click on the images for description

Description

Description:
BIS_fnc_guiMessage dialog in Arma 3

Displays an interactive message dialog in the center of the screen.

This function internally utilizes suspension (waitUntil to be specific) and therefore has to be executed in a scheduled environment.
Execution:
call
Groups:
GUI

Syntax

Syntax:
[message, header, okButton, cancelButton, parent, useParentBox, pause] call BIS_fnc_guiMessage
Parameters:
message: String or Structured Text - (Optional, default: "") message
header: String - (Optional, default: "") header text
okButton Boolean or String - (Optional, default true):
  • Boolean - enable the "OK" button
  • String - custom text for the "OK" button
cancelButton: Boolean or String - (Optional, default false):
  • Boolean - enable the "Cancel" button
  • String - custom text for the "Cancel" button
parent: Display - (Optional, default: [] call BIS_fnc_displayMission) parent display
useParentBox: Boolean - (Optional, default: false) try to use control inherited from "RscMessageBox" in parent instead of creating a new one
pause: Boolean - (Optional, default: true) pause simulation while message dialog is open (no effect in multiplayer)
Return Value:
Boolean - true if the "OK" button was pressed, otherwise false. Returned only after the message box is closed.

Examples

Example 1:
Because this example uses spawn, the return value of BIS_fnc_guiMessage is lost and can not be used.
["Hello World"] spawn BIS_fnc_guiMessage;
Example 2:
private _result = ["Are you sure?", "Confirm", true, true] call BIS_fnc_guiMessage; if (_result) then { systemChat "The player is sure."; } else { systemChat "The player is not sure."; };

Additional Information

See also:
BIS_fnc_GUIhint BIS_fnc_3DENShowMessage hintC

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
AgentRev - c
Posted on Jun 24, 2014 - 00:43 (UTC)
Message boxes can be force-closed with:
uiNamespace setVariable ["BIS_fnc_guiMessage_status", false];
Eden - c
Posted on Jan 13, 2016 - 15:16 (UTC)
Calling this function can cause an game crash. When doing this you have to spawn the function or add an spawn around it so you can use the result:
[] spawn { private _result = ["Are you sure?", "Confirm", true, true] call BIS_fnc_guiMessage; // Use _result here };
Demellion - c
Posted on Nov 01, 2017 - 18:35 (UTC)
This function only exists along with mission display (findDisplay 46). If this function is called before with -skipIntro parameter enabled (see Arma 3: Startup Parameters) it will result as Void.