createDisplay: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "<sqf>([^↵][^<]*↵[^<]*)<\/sqf>" to "<sqf> $1 </sqf>")
 
(68 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma |= Game name
|game1= arma1
|version1= 1.00


|1.00|= Game version
|game2= arma2
____________________________________________________________________________________________
|version2= 1.00


| Creates child display of given display and loads from "resourceName". The notable difference between [[createDisplay]] and [[createDialog]] is that with [[createDisplay]] the player would be able to move whilst having control of the mouse pointer.<br><br>
|game3= arma2oa
Since Arma 3 v1.49.131653 [[createDisplay]] returns [[Display]] and will first look in ''description.ext'' for resourceName config, if not found, it will then look in main config.<br><br>
|version3= 1.50
Displays created with both [[createDisplay]] and [[createDialog]] will take control of the mouse pointer and will close when user presses <tt>Esc</tt>.
<code>_emptyDisplay <nowiki>=</nowiki> [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty";</code>
If display is needed which exists independently, it can be created in IGUI layer with [[cutRsc]] command.
<code>"someLayer" [[cutRsc]] ["RscTitleDisplayEmpty", "PLAIN"];
_emptyDisplay <nowiki>=</nowiki> [[uiNamespace]] [[getVariable]] "RscTitleDisplayEmpty";</code>
Such display can be closed with [[closeDisplay]] command or by overwriting the same cut layer with another output. Note that "Unload" EH for some reason does not work with such display. |= Description
____________________________________________________________________________________________


| parent '''createDisplay''' resourceName |= Syntax
|game4= tkoh
|version4= 1.00


|p1= parent: [[Display]] |= Parameter 1
|game5= arma3
|version5= 0.50


|p2= resourceName: [[String]] - custom display class defined in [[description.ext]] or existing display class from main config |= Parameter 2
|gr1= GUI Control


| [[Nothing]] or (''Since Arma 3 v1.49.131653'') [[Display]] |= Return value
|descr= Creates child display of given display and loads from "resourceName". The notable difference between [[createDisplay]] and [[createDialog]] is that with [[createDisplay]] the player would be able to move around while the display is shown.<br>
____________________________________________________________________________________________
Displays created with [[createDisplay]] or [[createDialog]] will take control of the mouse pointer and will close when user presses {{Controls|Esc}}.
 
{{Feature|arma3|Since {{arma3}} v1.50 [[createDisplay]] returns [[Display]] and will first look in [[Description.ext|description.ext]] for resourceName config, if not found, it will then look in main config.}}
|x1= <code>[[findDisplay]] 46 [[createDisplay]] "RscCredits";</code> |= Example 1
{{Feature|informative|If an ''overlay'' is needed instead, use [[cutRsc]].}}


____________________________________________________________________________________________
|s1= parent [[createDisplay]]  resourceName


|[[closeDisplay]], [[createDialog]], [[displayCtrl]], [[dialog]], [[displayNull]], [[controlNull]], [[ctrlCreate]], [[displayParent]] |= See also
|p1= parent: [[Display]]


}}
|p2= resourceName: [[String]] - custom display class defined in [[Description.ext|description.ext]] or existing display class from main config


<h3 style="display:none">Notes</h3>
|r1= [[Display]] (since {{GVI|arma3|1.50|size= 0.75}}, [[Nothing]] before)
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|x1= <sqf>findDisplay 46 createDisplay "RscCredits";</sqf>
</dl>


<h3 style="display:none">Bottom Section</h3>
|x2= <sqf>
// creates an empty display
private _emptyDisplay = findDisplay 46 createDisplay "RscDisplayEmpty";
</sqf>


[[Category:Scripting Commands|CREATEDISPLAY]]
|seealso= [[closeDisplay]] [[createDialog]] [[displayCtrl]] [[dialog]] [[displayNull]] [[controlNull]] [[ctrlCreate]] [[displayParent]]
[[Category:Scripting Commands ArmA|CREATEDISPLAY]]
}}
[[Category:Command_Group:_GUI_Control|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Interaction|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= MrPineapple
<dd class="notedate">Posted on August 23, 2014 - 23:36 (UTC)</dd>
|timestamp= 20141115132000
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|text= When using createDisplay instead of [[createDialog]], all the commands for working with the controls of the display only work with the control version, not the IDC version:
<dd class="note">
<sqf>
Do not simply [[createDisplay]] from UI context code such as "ButtonDown" UI Event handler, as it will crash the game. Instead use [[spawn]] scope:
lbAdd [1234, "item"]; // does not work on displays, and won't error either
<code>[] [[spawn]] {[[findDisplay]] 46 [[createDisplay]] "RscCredits"};</code>
_ctrl lbAdd "item"; // does work with displays
</dd>
</sqf>
</dl>
So you have to use the control(DisplayCtrl) and not the IDC.
<!-- DISCONTINUE Notes -->
|game= arma3
|version= 1.34
}}


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= Killzone_Kid
<dd class="notedate">Posted on November 15, 2014 - 13:20 (UTC)</dd>
|timestamp= 20170629090200
<dt class="note">[[User:MrPineapple|MrPineapple]]</dt>
|text= A user dialog created with [[createDisplay]] over mission display ([[findDisplay]] 46) will stop [[displayAddEventHandler|display event handlers]] added to mission display from firing. However if it is created with [[createDialog]] then the event handlers continue to work.
<dd class="note">
}}
Arma3 v1.34
<br>
<br>
When using CreateDisplay instead of CreateDialog, all the commands for working with the controls of the display only work with the control version, not the IDC version.
<br>
<br>
EXAMPLE:
<code>LbAdd [1234, "item"];  // does not work on displays, and won't error either
_ctrl LbAdd "item";  // does work with displays</code>
<br>
So you have to use the control(DisplayCtrl) and not the IDC.


</dd>
{{Note
</dl>
|user= Target_practice
<!-- DISCONTINUE Notes -->
|timestamp= 20200621170100
|text= Creating a display with the same parent as an existing display will destroy the latter and all of its children. However, their [[User_Interface_Event_Handlers#onUnload|onUnload]], [[User_Interface_Event_Handlers#onChildDestroyed|onChildDestroyed]], and [[User_Interface_Event_Handlers#onDestroy|onDestroy]] event handlers will not fire.
}}


<!-- CONTINUE Notes -->
{{Note
<dl class="command_description">
|user= 7erra
<dd class="notedate">Posted on July 29, 2017 - 09:02 (UTC)</dd>
|timestamp= 20220205154714
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|text= When trying to create a display with [[createDisplay]] on a non existing display the command will fail silently and return [[displayNull]].
<dd class="note"> A user dialog created with [[createDisplay]] over mission display ([[findDisplay]] 46) will stop [[displayAddEventHandler|display event handlers]] added to mission display from firing. However if it is created with [[createDialog]] then the event handlers continue to work.
}}
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Latest revision as of 19:42, 3 September 2024

Hover & click on the images for description

Description

Description:
Creates child display of given display and loads from "resourceName". The notable difference between createDisplay and createDialog is that with createDisplay the player would be able to move around while the display is shown.
Displays created with createDisplay or createDialog will take control of the mouse pointer and will close when user presses Esc.
Arma 3
Since Arma 3 v1.50 createDisplay returns Display and will first look in description.ext for resourceName config, if not found, it will then look in main config.
If an overlay is needed instead, use cutRsc.
Groups:
GUI Control

Syntax

Syntax:
parent createDisplay resourceName
Parameters:
parent: Display
resourceName: String - custom display class defined in description.ext or existing display class from main config
Return Value:
Display (since Arma 3 logo black.png1.50, Nothing before)

Examples

Example 1:
findDisplay 46 createDisplay "RscCredits";
Example 2:
// creates an empty display private _emptyDisplay = findDisplay 46 createDisplay "RscDisplayEmpty";

Additional Information

See also:
closeDisplay createDialog displayCtrl dialog displayNull controlNull ctrlCreate displayParent

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
MrPineapple - c
Posted on Nov 15, 2014 - 13:20 (UTC)

When using createDisplay instead of createDialog, all the commands for working with the controls of the display only work with the control version, not the IDC version:

lbAdd [1234, "item"]; // does not work on displays, and won't error either _ctrl lbAdd "item"; // does work with displays
So you have to use the control(DisplayCtrl) and not the IDC.

Killzone_Kid - c
Posted on Jun 29, 2017 - 09:02 (UTC)
A user dialog created with createDisplay over mission display (findDisplay 46) will stop display event handlers added to mission display from firing. However if it is created with createDialog then the event handlers continue to work.
Target_practice - c
Posted on Jun 21, 2020 - 17:01 (UTC)
Creating a display with the same parent as an existing display will destroy the latter and all of its children. However, their onUnload, onChildDestroyed, and onDestroy event handlers will not fire.
7erra - c
Posted on Feb 05, 2022 - 15:47 (UTC)
When trying to create a display with createDisplay on a non existing display the command will fail silently and return displayNull.