ctrlCreate: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Bot: Reverted to revision 110558 by killzone_kid on 2018-11-19T12:12:33Z)
m (template:command argument fix)
Line 22: Line 22:
| display '''ctrlCreate''' [class, idc, controlsGroup] |= Syntax
| display '''ctrlCreate''' [class, idc, controlsGroup] |= Syntax


|p1= display: [[Display]] - Display in which control will be created  |= PARAMETER1
|p1= display: [[Display]] - Display in which control will be created  |PARAMETER1=  


|p2= [class, idc, controlsGroup]: [[Array]] |=
|p2= [class, idc, controlsGroup]: [[Array]] |=


|p3= class: [[String]] - Existing classname (see [[ctrlCreate/classnames]]) of the new control (Since  Arma 3 v1.69.141213 it is possible to use classes defined in mission config)  |= PARAMETER2
|p3= class: [[String]] - Existing classname (see [[ctrlCreate/classnames]]) of the new control (Since  Arma 3 v1.69.141213 it is possible to use classes defined in mission config)  |PARAMETER2=  


|p4= idc: [[Number]] - IDC of the new control (use -1 if you don't care what it should be) |= PARAMETER3
|p4= idc: [[Number]] - IDC of the new control (use -1 if you don't care what it should be) |PARAMETER3=


|p5= controlsGroup (Optional): [[Control]] - Creates controls in existing controls group |= PARAMETER3
|p5= controlsGroup (Optional): [[Control]] - Creates controls in existing controls group |PARAMETER3=


| [[Control]] |= RETURNVALUE
| [[Control]] |RETURNVALUE=  




|x1= <code>_display [[ctrlCreate]] ["RscText", 1234];</code>|= EXAMPLE1
|x1= <code>_display [[ctrlCreate]] ["RscText", 1234];</code>|EXAMPLE1=  
|x2= <code>_map = [[findDisplay]] 46 [[ctrlCreate]] ["RscMapControl", -1];
|x2= <code>_map = [[findDisplay]] 46 [[ctrlCreate]] ["RscMapControl", -1];
_multiLineText = [[findDisplay]] 46 [[ctrlCreate]] ["RscTextMulti", -1];
_multiLineText = [[findDisplay]] 46 [[ctrlCreate]] ["RscTextMulti", -1];
_multiLineEdit = [[findDisplay]] 46 [[ctrlCreate]] ["RscEditMulti", -1];</code>|= EXAMPLE2
_multiLineEdit = [[findDisplay]] 46 [[ctrlCreate]] ["RscEditMulti", -1];</code>|EXAMPLE2=
|x3= <code>myControl = [[findDisplay]] 0 [[ctrlCreate]] ["RscText", 1234, [[findDisplay]] 0 [[displayCtrl]] 2300];</code>|= EXAMPLE3
|x3= <code>myControl = [[findDisplay]] 0 [[ctrlCreate]] ["RscText", 1234, [[findDisplay]] 0 [[displayCtrl]] 2300];</code>|EXAMPLE3=
|x4= Create Tree View control with search. Available <tt>RscTreeSearch</tt> class is hardcoded to be used with <tt>RscEdit</tt> with idc <tt>645</tt>. Example below demonstrates how to. After tree is generated, try typing something in the top box.
|x4= Create Tree View control with search. Available <tt>RscTreeSearch</tt> class is hardcoded to be used with <tt>RscEdit</tt> with idc <tt>645</tt>. Example below demonstrates how to. After tree is generated, try typing something in the top box.
<code>[] [[spawn]]
<code>[] [[spawn]]
Line 80: Line 80:
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[allControls]], [[allDisplays]], [[controlsGroupCtrl]], [[ctrlDelete]], [[ctrlModel]], [[ctrlSetModel]], [[ctrlPosition]], [[ctrlSetPosition]], [[ctrlClassName]], [[ctrlModelScale]], [[ctrlSetModelScale]], [[ctrlModelDirAndUp]], [[ctrlSetModelDirAndUp]], [[displayParent]] |= SEEALSO
| [[allControls]], [[allDisplays]], [[controlsGroupCtrl]], [[ctrlDelete]], [[ctrlModel]], [[ctrlSetModel]], [[ctrlPosition]], [[ctrlSetPosition]], [[ctrlClassName]], [[ctrlModelScale]], [[ctrlSetModelScale]], [[ctrlModelDirAndUp]], [[ctrlSetModelDirAndUp]], [[displayParent]] |SEEALSO=  


|  |= MPBEHAVIOUR
|  |MPBEHAVIOUR=  
____________________________________________________________________________________________
____________________________________________________________________________________________
}}
}}

Revision as of 10:30, 7 April 2019

Hover & click on the images for description

Description

Description:
Creates a new control in the given display. The control class could be existing class from main config or custom class defined in mission config (mission config is searched first). Some of the common controls defined in main config that can be used with this command:
  • RscText - simple text box
  • RscTextMulti - simple multiline text box
  • RscPicture - simple picture box
  • RscPictureKeepAspect - picture box that doesn't stretch picture
  • RscEdit - input box
  • RscEditMulti - multiline input box
  • RscTree - tree view control
  • RscTreeSearch - searchable tree view control (see Example 4)
  • RscVideo - picture control with autostart for video texture (see BIS_fnc_playVideo)
  • RscVideoKeepAspect - picture control for video to keep original video aspect ratio
Groups:
Uncategorised

Syntax

Syntax:
display ctrlCreate [class, idc, controlsGroup]
Parameters:
display: Display - Display in which control will be created
[class, idc, controlsGroup]: Array
class: String - Existing classname (see ctrlCreate/classnames) of the new control (Since Arma 3 v1.69.141213 it is possible to use classes defined in mission config)
idc: Number - IDC of the new control (use -1 if you don't care what it should be)
controlsGroup (Optional): Control - Creates controls in existing controls group
Return Value:
Control

Examples

Example 1:
_display ctrlCreate ["RscText", 1234];
Example 2:
_map = findDisplay 46 ctrlCreate ["RscMapControl", -1]; _multiLineText = findDisplay 46 ctrlCreate ["RscTextMulti", -1]; _multiLineEdit = findDisplay 46 ctrlCreate ["RscEditMulti", -1];
Example 3:
myControl = findDisplay 0 ctrlCreate ["RscText", 1234, findDisplay 0 displayCtrl 2300];
Example 4:
Create Tree View control with search. Available RscTreeSearch class is hardcoded to be used with RscEdit with idc 645. Example below demonstrates how to. After tree is generated, try typing something in the top box. [] spawn { disableSerialization; _display = findDisplay 46 createDisplay "RscDisplayEmpty"; _edit = _display ctrlCreate ["RscEdit", 645]; _edit ctrlSetPosition [0,0,1,0.04]; _edit ctrlSetBackgroundColor [0,0,0,1]; _edit ctrlCommit 0; _tv = _display ctrlCreate ["RscTreeSearch", -1]; _tv ctrlSetFont "EtelkaMonospacePro"; _tv ctrlSetFontHeight 0.03; _tv ctrlSetPosition [0,0.06,1,0.94]; _tv ctrlSetBackgroundColor [0,0,0,1]; _tv ctrlCommit 0; _classes = "true" configClasses (configFile >> "CfgVehicles"); for "_i" from 0 to 5 do { _tv tvAdd [[], configName selectRandom _classes]; for "_j" from 0 to 5 do { _tv tvAdd [[_i], configName selectRandom _classes]; for "_k" from 0 to 5 do { _tv tvAdd [[_i, _j], configName selectRandom _classes]; for "_n" from 0 to 5 do { _tv tvAdd [[_i, _j, _k], configName selectRandom _classes]; }; }; }; }; };

Additional Information

See also:
allControlsallDisplayscontrolsGroupCtrlctrlDeletectrlModelctrlSetModelctrlPositionctrlSetPositionctrlClassNamectrlModelScalectrlSetModelScalectrlModelDirAndUpctrlSetModelDirAndUpdisplayParent

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

Notes

Bottom Section