ACE3/addons/interaction/functions/fnc_renameGroupUI.sqf
Seb 88e774c30d
Interaction - Rename group self-interact (#8346)
* Group renaming self interact

* UI base

* Custom UI solution (looks terrible)

* Improve GUI, optimise functions

* Add exitWith return value to fnc_renameGroup

* tabs to spaces

* Small tweaks

* newlines

pre-empting newline gestapo

* input prompt caps

* Implement suggestions

* Remove already inherited value

* Per-side group name handling

* Add same group case sensitive changes.

* Suggestions

- Use ace_common_fnc_displayTextStructured
- Formatting
- Phrasing of strings

* replace spawn with CBA_fnc_execNextFrame

* Update addons/interaction/initSettings.sqf

Co-authored-by: PabstMirror <pabstmirror@gmail.com>

Co-authored-by: PabstMirror <pabstmirror@gmail.com>
2021-10-12 12:53:35 -05:00

37 lines
1.0 KiB
Plaintext

#include "script_component.hpp"
/*
* Author: Seb
* Shows a UI to allow a unit to change its group ID.
*
* Arguments:
* 0: The unit renaming their group <OBJECT>
*
* Return Value:
* None
*
* Example:
* player call ace_interaction_fnc_renameGroupUI
*
* Public: No
*/
// delay a frame so we don't overlap with interaction-menu as it closes
[{
params [["_unit", objNull, [objNull]]];
private _display = findDisplay 46 createDisplay QGVAR(groupNameDisplay);
private _textCtrl = _display displayCtrl 451;
_textCtrl ctrlSetText (groupID group _unit);
_display setVariable [QGVAR(renamedGroup), group _unit];
_display displayAddEventHandler ["Unload", {
params ["_display", "_exitCode"];
if !(_exitCode isEqualTo 1) exitWith {};
private _group = _display getVariable QGVAR(renamedGroup);
private _textCtrl = _display displayCtrl 451;
private _newName = ctrlText _textCtrl;
[_group, _newName] call FUNC(renameGroup);
}];
}, _this] call CBA_fnc_execNextFrame;