ACE3/addons/zeus/functions/fnc_ui_attributeRadius.sqf
Kyle Mckay e47e18001f
Docs - Update my display name everywhere (#9330)
* Update display name in team

* Update display name everywhere

* order

https://youtu.be/VYycQTm2HrM

---------

Co-authored-by: BrettMayson <brett@mayson.io>
2023-08-17 12:02:17 +02:00

48 lines
1.1 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: kymckay
* Initializes the "Radius" Zeus module attribute.
*
* Arguments:
* 0: radius controls group <CONTROL>
*
* Return Value:
* None
*
* Example:
* [CONTROL] call ace_zeus_fnc_ui_attributeRadius
*
* Public: No
*/
// Generic init
params ["_control"];
private _display = ctrlParent _control;
_control ctrlRemoveAllEventHandlers "SetFocus";
// Specific onLoad stuff
private _edit = _control controlsGroupCtrl 26467;
_edit ctrlSetText "100";
private _fnc_onKeyUp = {
params ["_display"];
private _edit = _display displayCtrl 26467;
private _radius = parseNumber (ctrlText _edit);
// Handle invalid radius (non-numerical input)
if (_radius == 0) then {
_edit ctrlSetTooltip (localize LSTRING(AttributeRadiusInvalid));
_edit ctrlSetTextColor [1,0,0,1];
} else {
_edit ctrlSetTooltip "";
_edit ctrlSetTextColor [1,1,1,1];
SETVAR(_display,GVAR(radius),_radius);
};
};
[_display] call _fnc_onKeyUp;
_display displayAddEventHandler ["KeyUp", _fnc_onKeyUp];