isUIContext: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Convert note to examples)
Line 15: Line 15:




|x1= <code>[[if]] ([[isUIContext]]) [[then]] {[[hint]] "UI control event"};</code>|= EXAMPLE2
|x1= <code>[[if]] ([[isUIContext]]) [[then]] {[[hint]] "UI control event"};</code>|= EXAMPLE1
|x2= <code>_button [[ctrlSetEventHandler]] ['ButtonClick',"[[call]] {[[diag_log]] [[isUIContext]]}"]; // Outputs true</code>|= EXAMPLE2
|x3= <code>_button [[ctrlSetEventHandler]] ['ButtonClick',"[] [[spawn]] {[[diag_log]] [[isUIContext]]}"]; // Outputs false</code>|= EXAMPLE3
____________________________________________________________________________________________
____________________________________________________________________________________________


Line 35: Line 37:
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on September 12, 2017 - 12:46 (UTC)</dd>
<dt class="note">[[User:Demellion|Demellion]]</dt>
<dd class="note">
'''NOTE''': The invocation source never reccur to a newly generated threads (e.g. [[spawn]], [[execVM]], [[remoteExec]]).Example with RscButton:
<code>_button ctrlSetEventHandler ['ButtonClick',"0 call {systemChat str(isUIContext)}"]; // Will return as true
_button ctrlSetEventHandler ['ButtonClick',"0 spawn {systemChat str(isUIContext)}"]; // Will always return false
</code>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 19:12, 11 January 2018

Hover & click on the images for description

Description

Description:
Returns true if the script originated from some UI control event, for example from "onButtonDown" EH. Exists within parent scope and immediate child scopes.
Groups:
Uncategorised

Syntax

Syntax:
isUIContext
Return Value:
Boolean

Examples

Example 1:
if (isUIContext) then {hint "UI control event"};
Example 2:
_button ctrlSetEventHandler ['ButtonClick',"call {diag_log isUIContext}"]; // Outputs true
Example 3:
_button ctrlSetEventHandler ['ButtonClick',"[] spawn {diag_log isUIContext}"]; // Outputs false

Additional Information

See also:
canSuspendisRemoteExecutedisRemoteExecutedJIP

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