2016-05-18 23:16:50 +00:00
|
|
|
/*
|
|
|
|
* Author: SilentSpike
|
2018-04-24 17:46:59 +00:00
|
|
|
* Initializes the "Radius" Zeus module attribute.
|
2016-05-18 23:16:50 +00:00
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* 0: radius controls group <CONTROL>
|
|
|
|
*
|
|
|
|
* Return Value:
|
2016-11-15 12:07:48 +00:00
|
|
|
* None
|
2016-05-18 23:16:50 +00:00
|
|
|
*
|
2017-06-08 13:31:51 +00:00
|
|
|
* Example:
|
|
|
|
* [CONTROL] call ace_zeus_fnc_ui_attributeRadius
|
|
|
|
*
|
2016-05-18 23:16:50 +00:00
|
|
|
* Public: No
|
|
|
|
*/
|
|
|
|
#include "script_component.hpp"
|
|
|
|
|
2018-04-24 17:46:59 +00:00
|
|
|
// Generic init
|
2016-05-18 23:16:50 +00:00
|
|
|
params ["_control"];
|
|
|
|
private _display = ctrlParent _control;
|
|
|
|
|
2018-04-24 17:46:59 +00:00
|
|
|
_control ctrlRemoveAllEventHandlers "SetFocus";
|
2016-05-18 23:16:50 +00:00
|
|
|
|
2018-04-24 17:46:59 +00:00
|
|
|
// Specific onLoad stuff
|
2016-05-18 23:16:50 +00:00
|
|
|
private _edit = _control controlsGroupCtrl 26467;
|
|
|
|
|
2016-05-21 16:29:53 +00:00
|
|
|
_edit ctrlSetText "100";
|
2016-05-18 23:16:50 +00:00
|
|
|
|
|
|
|
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;
|
2018-04-24 17:46:59 +00:00
|
|
|
_display displayAddEventHandler ["KeyUp", _fnc_onKeyUp];
|