From 0a5a77ae1fc983c15a525cf87f2e83008f0ab170 Mon Sep 17 00:00:00 2001 From: mharis001 Date: Tue, 11 Feb 2020 19:41:16 -0500 Subject: [PATCH] Settings - Fix list default value tooltip for non-numeric values --- addons/settings/gui_createCategory.sqf | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/settings/gui_createCategory.sqf b/addons/settings/gui_createCategory.sqf index e84b6e96d..3fc7bb514 100644 --- a/addons/settings/gui_createCategory.sqf +++ b/addons/settings/gui_createCategory.sqf @@ -134,9 +134,11 @@ private _lastSubCategory = "$START"; }; // ----- determine display string for default value - private _defaultValueToolTip = switch (toUpper _settingType) do { + private _defaultValueTooltip = switch (toUpper _settingType) do { case "LIST": { - private _label = (_settingData param [1, []]) param [_defaultValue, ""]; + _settingData params ["_values", "_labels"]; + + private _label = _labels param [_values find _defaultValue, ""]; if (isLocalized _label) then { _label = localize _label; @@ -152,7 +154,7 @@ private _lastSubCategory = "$START"; }; }; case "COLOR": { - private _template = (["R: %1","%G: %2", "B: %3", "A: %4"] select [0, count _defaultValue]) joinString "\n"; + private _template = (["R: %1", "G: %2", "B: %3", "A: %4"] select [0, count _defaultValue]) joinString "\n"; format ([_template] + _defaultValue) }; case "TIME": { @@ -163,7 +165,7 @@ private _lastSubCategory = "$START"; // ----- set tooltip on "Reset to default" button private _ctrlDefault = _ctrlSettingGroup controlsGroupCtrl IDC_SETTING_DEFAULT; - _ctrlDefault ctrlSetTooltip (format ["%1\n%2", localize LSTRING(default_tooltip), _defaultValueToolTip]); + _ctrlDefault ctrlSetTooltip (format ["%1\n%2", localize LSTRING(default_tooltip), _defaultValueTooltip]); _ctrlSettingGroup setVariable [QGVAR(setting), _setting]; _ctrlSettingGroup setVariable [QGVAR(source), _source];