ctrlIDC

From Bohemia Interactive Community
Jump to navigation Jump to search
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.