isUIContext: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (template:command argument fix)
m (Some wiki formatting)
 
(29 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Command|= Comments
{{RV|type=command
____________________________________________________________________________________________


| arma3 |= Game name
|game1= arma3
|1.76|= Game version
|version1= 1.76


____________________________________________________________________________________________
|gr1= GUI Control


| Returns [[true]] if the script originated from some UI control event, for example from "onButtonDown" EH. Exists within parent scope and immediate child scopes. |= Description
|gr2= Program Flow
____________________________________________________________________________________________


| '''isUIContext'''  |= Syntax
|descr= Returns [[true]] if the script originated from some UI control event, for example from "onButtonDown" EH. Exists within parent scope and immediate child scopes.


| [[Boolean]] |RETURNVALUE=
|s1= [[isUIContext]]


|r1= [[Boolean]]


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


| [[canSuspend]], [[isRemoteExecuted]], [[isRemoteExecutedJIP]], [[serverCommand]] |SEEALSO=
|x2= <sqf>_button ctrlSetEventHandler ["ButtonDown", "call { diag_log isUIContext }"]; // outputs true</sqf>


| |MPBEHAVIOUR=  
|x3= <sqf>_button ctrlSetEventHandler ["ButtonDown", "0 spawn { diag_log isUIContext }"]; // outputs false</sqf>
____________________________________________________________________________________________
 
|seealso= [[canSuspend]] [[isRemoteExecuted]] [[isRemoteExecutedJIP]] [[isGamePaused]] [[isGameFocused]] [[serverCommand]]
}}
}}
<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:Arma_3:_New_Scripting_Commands_List|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]

Latest revision as of 12:49, 6 May 2022

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:
GUI ControlProgram Flow

Syntax

Syntax:
isUIContext
Return Value:
Boolean

Examples

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

Additional Information

See also:
canSuspend isRemoteExecuted isRemoteExecutedJIP isGamePaused isGameFocused serverCommand

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