ctrlIDC: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Text replacement - "\[\[Category:[ _]?Scripting[ _]Commands[ _]Arma[ _]3(\|.*)]]" to "{{GameCategory|arma3|Scripting Commands}}") |
No edit summary |
||
(29 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{RV|type=command | ||
| arma3 | | |game1= arma3 | ||
|version1= 0.50 | |||
| | |gr1= GUI Control | ||
| | |descr= Returns control IDC. | ||
| | |s1= [[ctrlIDC]] control | ||
| | |p1= control: [[Control]] | ||
| | |r1= [[Number]] | ||
| | |x1= <sqf>ctrlIDC _ctrl;</sqf> | ||
|x2= <sqf>ctrlIDC controlNull; // returns -1</sqf> | |||
|seealso= [[allControls]] [[allDisplays]] [[controlsGroupCtrl]] [[ctrlDelete]] [[ctrlModel]] [[ctrlSetModel]] [[ctrlPosition]] [[ctrlSetPosition]] [[ctrlClassName]] [[ctrlModelScale]] [[ctrlSetModelScale]] [[ctrlModelDirAndUp]] [[ctrlSetModelDirAndUp]] [[displayParent]] | |||
}} | |||
| | {{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. | |||
}} | }} | ||
Latest revision as of 20:39, 22 April 2024
Description
- Description:
- Returns control IDC.
- Groups:
- GUI Control
Syntax
Examples
- Example 1:
- ctrlIDC _ctrl;
- Example 2:
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
- 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:
however, keep in mind that most controls have[ controlNull ] call { if( ctrlIDC( _this select 0 ) > -1 ) then { systemChat "the control exists!" } }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.