ctrlIDC: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|= Game name" to "|Game name=")
No edit summary
 
(37 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| arma3 |Game name=
|game1= arma3
|version1= 0.50


|0.50|= Game version
|gr1= GUI Control
____________________________________________________________________________________________


| Returns control IDC. |DESCRIPTION=
|descr= Returns control IDC.
____________________________________________________________________________________________


| '''ctrlIDC''' control |SYNTAX=
|s1= [[ctrlIDC]]  control


|p1= control: [[Control]] |PARAMETER1= 
|p1= control: [[Control]]


| [[Number]] |RETURNVALUE=
|r1= [[Number]]


|x1= <sqf>ctrlIDC _ctrl;</sqf>
|x2= <sqf>ctrlIDC controlNull; // returns -1</sqf>


|x1= <code>[[ctrlIDC]] _ctrl;</code>|EXAMPLE1=
|seealso= [[allControls]] [[allDisplays]] [[controlsGroupCtrl]] [[ctrlDelete]] [[ctrlModel]] [[ctrlSetModel]] [[ctrlPosition]] [[ctrlSetPosition]] [[ctrlClassName]] [[ctrlModelScale]] [[ctrlSetModelScale]] [[ctrlModelDirAndUp]] [[ctrlSetModelDirAndUp]] [[displayParent]]
 
}}
____________________________________________________________________________________________
 
| [[allControls]], [[allDisplays]], [[controlsGroupCtrl]], [[ctrlDelete]], [[ctrlModel]], [[ctrlSetModel]], [[ctrlPosition]], [[ctrlSetPosition]], [[ctrlClassName]], [[ctrlModelScale]], [[ctrlSetModelScale]], [[ctrlModelDirAndUp]], [[ctrlSetModelDirAndUp]], [[displayParent]] |SEEALSO=


| |MPBEHAVIOUR=  
{{Note
____________________________________________________________________________________________
|user= Nelis.75733126
|timestamp= 20240422183939
|text= Example 2 is very handy for checking if a given control is [[controlNull]] without using negation.<br>
Here is a practical example of that:<br>
<sqf>[ controlNull ] call {
    if( ctrlIDC( _this select 0 ) > -1 ) then { systemChat "the control exists!" }
}</sqf>
'''however, keep in mind that most controls have <syntaxhighlight lang="cpp" inline>idc = -1;</syntaxhighlight> by default.''' But that is easy to change :)<br>
The method shown above works great for functions where a control or controlNull could get passed into.<br>If the function should only do something if the control exists, then that method is a great way to handle that while avoiding negation.
}}
}}
<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:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Arma 3: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_GUI_Control|{{uc:{{PAGENAME}}}}]]

Latest revision as of 20:39, 22 April 2024

Hover & click on the images for description

Description

Description:
Returns control IDC.
Groups:
GUI Control

Syntax

Syntax:
ctrlIDC control
Parameters:
control: Control
Return Value:
Number

Examples

Example 1:
ctrlIDC _ctrl;
Example 2:
ctrlIDC controlNull; // returns -1

Additional Information

See also:
allControls allDisplays controlsGroupCtrl ctrlDelete ctrlModel ctrlSetModel ctrlPosition ctrlSetPosition ctrlClassName ctrlModelScale ctrlSetModelScale ctrlModelDirAndUp ctrlSetModelDirAndUp 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
Nelis.75733126 - c
Posted on Apr 22, 2024 - 18:39 (UTC)
Example 2 is very handy for checking if a given control is controlNull without using negation.
Here is a practical example of that:
[ controlNull ] call { if( ctrlIDC( _this select 0 ) > -1 ) then { systemChat "the control exists!" } }
however, keep in mind that most controls have idc = -1; by default. But that is easy to change :)
The method shown above works great for functions where a control or controlNull could get passed into.
If the function should only do something if the control exists, then that method is a great way to handle that while avoiding negation.