|
|
(30 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| {{Function|Comments= | | {{RV|type=function |
| ____________________________________________________________________________________________
| |
|
| |
|
| | arma3 |Game name= | | |game1= arma3 |
| | |version1= 1.00 |
|
| |
|
| |1.00|= Game version | | |gr1= GUI |
|
| |
|
| |gr1 = GUI |GROUP1= | | |descr= This function is a central part of how BI handles UIs. For a full explanation see [[GUI_Tutorial#BIS_fnc_initDisplay|this page]]. |
| ____________________________________________________________________________________________
| |
|
| |
|
| | A function related to displays that is called on the following occasions: | | |s1= parameters call [[BIS_fnc_initDisplay]] |
| * Game start
| |
| * Display opened
| |
| * Display closed
| |
| | |
| {{Important|This information is only useful for GUIs in an addon, not for mission level GUIs!}}
| |
| | |
| The usual config of a display that uses this function looks like this:
| |
| <syntaxhighlight lang=cpp>
| |
| class RscDisplayAAR
| |
| {
| |
| scriptName = "RscDisplayAAR";
| |
| scriptPath = "GUI";
| |
| onLoad = "[""onLoad"",_this,""RscDisplayAAR"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')";
| |
| onUnload = "[""onUnload"",_this,""RscDisplayAAR"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')";
| |
| idd = 2121;
| |
| //...
| |
| </syntaxhighlight>
| |
| A macro for easier use is available:
| |
| <syntaxhighlight lang=cpp>
| |
| #include "\a3\ui_f\hpp\defineCommon.inc"
| |
| class RscDisplayAAR
| |
| {
| |
| INIT_DISPLAY(RscDisplayAAR,GUI)
| |
| idd = 2121;
| |
| //...
| |
| </syntaxhighlight>
| |
| translates to the same partial class as above.<br>
| |
| <br>
| |
| On game start:<br>
| |
| The function searches for "scriptName" and "scriptPath" entries in the subclasses of the following configs:
| |
| * [[configFile]]
| |
| * configFile >> "RscTitles"
| |
| * configFile >> "RscInGameUI"
| |
| * configFile >> "Cfg3DEN" >> "Attributes"
| |
| If both of these attributes are defined (and the attribute "scriptIsInternal" is not defined or 0) then the display function is compiled into the [[uiNamespace]] in the following way: The "scriptPath" attribute points to a config attribute in {{Inline code|configFile >> "CfgScriptPaths"}} which in turn points to a folder in which the {{Inline code|scriptName.sqf}} resides, for example "\a3\ui_f\scripts\GUI\RscDisplayAAR.sqf". The function name of this display's uiNamespace function is therefore {{Inline code|RscDisplayAAR_script}}.
| |
| <br><br>
| |
| When the display is opened or closed:<br>
| |
| The [[User_Interface_Event_Handlers|User Interface Eventhandlers]] for the onLoad or onUnload event are triggered. The following then happens:<br>
| |
| onLoad:
| |
| * Display is registred:
| |
| ** The config class of the display (eg. RscDisplayAAR) is saved as "BIS_fnc_initDisplay_configClass" to the display
| |
| ** A list of open UIs ({{Inline code|uiNamespace getVariable ["PATH_displays", []]}}) is updated with the display, where PATH is the afformentioned scriptPath, eg GUI_displays
| |
| * The display's script (eg. RscDisplayAAR_script) is executed in uiNamespace
| |
| | |
| onUnload:
| |
| * The display is removed from the list of open displays
| |
| * The display's script (eg. RscDisplayAAR_script) is executed in uiNamespace
| |
| | |
| In both events the following arguments are passed to the display's script:
| |
| <code>params ["_mode", "_params", "_class"];</code>
| |
| * 0: STRING - Either "onLoad" or "onUnload" for their respective events
| |
| * 1: ARRAY - The parameters of the UIEH
| |
| * 2: STRING - Config classname of the display
| |
| |DESCRIPTION=
| |
| ____________________________________________________________________________________________
| |
| | |
| | parameters call [[BIS_fnc_initDisplay]] |SYNTAX=
| |
|
| |
|
| |p1= parameters: [[Array]] | | |p1= parameters: [[Array]] |
| * [ ] (empty array) - init displays during preStart | | * [] - Init displays during preStart |
| * [mode, params, displayClass, scriptPath, register] | | * [mode, params, displayClass, scriptPath, register] |
| ** mode: [[String]] - mode, can be "onLoad" or "onUnload" | | ** mode: [[String]] - Mode, can be "onLoad" or "onUnload" |
| ** params: [[Array]] - params passed from [[User_Interface_Event_Handlers#onLoad|onLoad]] or [[User_Interface_Event_Handlers#onUnload|onUnload]] UI event handler | | ** params: [[Array]] - Parameters passed from [[User_Interface_Event_Handlers#onLoad|onLoad]] or [[User_Interface_Event_Handlers#onUnload|onUnload]] UI event handler |
| ** displayClass: [[String]] - [[Display]] class, usually to format "RscDisplayXXX" | | ** displayClass: [[String]] - [[Display]] class, usually to format "RscDisplayXXX" |
| ** scriptPath: [[String]] - script path from CfgScriptPaths | | ** scriptPath: [[String]] - Script path from CfgScriptPaths |
| ** register: [[Number]] or [[Bool]] - Save variables associated with the display to the uiNamespace. Usually this is <tt>false</tt> when the function is called from a control. | | ** register: [[Number]] or [[Boolean]] - Save variables associated with the display to the uiNamespace. Usually this is {{hl|false}} when the function is called from a control. |
| |PARAMETER1= | | |
| | |
| | |r1= Nothing |
|
| |
|
| | Nothing |RETURNVALUE= | | |x1= <sqf>["onLoad", _this, "RscDisplayAAR", "GUI", true] call (uiNamespace getVariable "BIS_fnc_initDisplay");</sqf> |
| ____________________________________________________________________________________________
| |
|
| |
|
| |x1= <code>["onLoad", [[_this]], "RscDisplayAAR", "GUI", true] [[call]] ([[uiNamespace]] [[getVariable]] "[[BIS_fnc_initDisplay]]");</code> |EXAMPLE1= | | |seealso= [[GUI Tutorial]] [[Arma: GUI Configuration]] |
| ____________________________________________________________________________________________
| |
|
| |
|
| | |SEEALSO=
| |
| }} | | }} |
|
| |
| <h3 style="display:none">Notes</h3>
| |
| <dl class="command_description">
| |
| <!-- Note Section BEGIN -->
| |
|
| |
| <!-- Note Section END -->
| |
| </dl>
| |
|
| |
| <h3 style="display:none">Bottom Section</h3>
| |
|
| |
| [[Category:Functions|{{uc:initDisplay}}]]
| |
| [[Category:{{Name|arma3}}: Functions|{{uc:initDisplay}}]]
| |