From f294a21dc4da4561e2cdd0d86cb75d2239bb7c1a Mon Sep 17 00:00:00 2001 From: ConnorAU Date: Wed, 6 May 2020 15:56:23 +1000 Subject: [PATCH] Moved parameters into a single array so I stop breaking things when I add new options --- addon/systems/displayColorPicker.sqf | 6 +++++- addon/systems/displayGuiMessage.sqf | 5 ++++- addon/systems/displayListbox.sqf | 13 +++++++++---- addon/systems/displaySlider.sqf | 9 ++++++--- addon/systems/displayText.sqf | 7 +++++-- 5 files changed, 29 insertions(+), 11 deletions(-) diff --git a/addon/systems/displayColorPicker.sqf b/addon/systems/displayColorPicker.sqf index 585fc15..69b2416 100644 --- a/addon/systems/displayColorPicker.sqf +++ b/addon/systems/displayColorPicker.sqf @@ -37,13 +37,17 @@ #define GRID_COLOR(x,i) linearConversion[0,VAL_CELL_COUNT,x,i,1,true] params [ - ["_color",[],[[],""]], + ["_parameters",[],[[]]], ["_title","",[""]], ["_code",{},[{}]], ["_button1","",[""]], ["_button2",0,[""]], ["_parentDisplay",displayNull,[displayNull]] ]; +_parameters params [ + ["_color",[],[[],""]] +]; + if (!isNull _parentDisplay) then { _parentDisplay createDisplay QUOTE(DISPLAY_NAME); } else { diff --git a/addon/systems/displayGuiMessage.sqf b/addon/systems/displayGuiMessage.sqf index 98f9b23..125d317 100644 --- a/addon/systems/displayGuiMessage.sqf +++ b/addon/systems/displayGuiMessage.sqf @@ -12,13 +12,16 @@ #include "_defines.inc" params [ - ["_text","",[""]], + ["_parameters",[],[[]]], ["_title","",[""]], ["_code",{},[{}]], ["_button1","",[""]], ["_button2",0,[""]], ["_parentDisplay",displayNull,[displayNull]] ]; +_parameters params [ + ["_text","",[""]] +]; if (!isNull _parentDisplay) then { _parentDisplay createDisplay QUOTE(DISPLAY_NAME); diff --git a/addon/systems/displayListbox.sqf b/addon/systems/displayListbox.sqf index 45ec4c6..4c1266a 100644 --- a/addon/systems/displayListbox.sqf +++ b/addon/systems/displayListbox.sqf @@ -11,15 +11,18 @@ #include "_defines.inc" params [ - ["_items",[],[[]]], - ["_startIndex",0,[0]], - ["_multiSel",false,[true]], + ["_parameters",[],[[]]], ["_title","",[""]], ["_code",{},[{}]], ["_button1","",[""]], ["_button2",0,[""]], ["_parentDisplay",displayNull,[displayNull]] ]; +_parameters params [ + ["_items",[],[[]]], + ["_startIndex",0,[0]], + ["_multiSel",false,[true]] +]; if (!isNull _parentDisplay) then { _parentDisplay createDisplay ([QUOTE(DISPLAY_NAME),QUOTE(JOIN(DISPLAY_NAME,Multi))] select _multiSel); @@ -98,4 +101,6 @@ lbClear _ctrlInput; _ctrlInput lbSetValue [_index,_value]; } forEach _items; -_ctrlInput lbSetCurSel (0 max _startIndex min (lbSize _ctrlInput - 1)); \ No newline at end of file +private _index = 0 max _startIndex min (lbSize _ctrlInput - 1); +_ctrlInput lbSetCurSel _index; +if _multiSel then {_ctrlInput lbSetSelected [_index,true]}; \ No newline at end of file diff --git a/addon/systems/displaySlider.sqf b/addon/systems/displaySlider.sqf index 2cf080b..94883ba 100644 --- a/addon/systems/displaySlider.sqf +++ b/addon/systems/displaySlider.sqf @@ -11,9 +11,7 @@ #include "_defines.inc" params [ - ["_range",[0,0],[[]],2], - ["_position",0,[0]], - ["_speed",[1,1],[[]],2], + ["_parameters",[],[[]]], ["_title","",[""]], ["_formatVal",{},[{}]], ["_code",{},[{}]], @@ -21,6 +19,11 @@ params [ ["_button2",0,[""]], ["_parentDisplay",displayNull,[displayNull]] ]; +_parameters params [ + ["_range",[0,0],[[]],2], + ["_position",0,[0]], + ["_speed",[1,1],[[]],2] +]; if (!isNull _parentDisplay) then { _parentDisplay createDisplay QUOTE(DISPLAY_NAME); diff --git a/addon/systems/displayText.sqf b/addon/systems/displayText.sqf index 32c8c87..072d5bc 100644 --- a/addon/systems/displayText.sqf +++ b/addon/systems/displayText.sqf @@ -11,14 +11,17 @@ #include "_defines.inc" params [ - ["_multiLine",false,[true]], - ["_startText","",[""]], + ["_parameters",[],[[]]], ["_title","",[""]], ["_code",{},[{}]], ["_button1","",[""]], ["_button2",0,[""]], ["_parentDisplay",displayNull,[displayNull]] ]; +_parameters params [ + ["_multiLine",false,[true]], + ["_startText","",[""]] +]; if (!isNull _parentDisplay) then { _parentDisplay createDisplay ([QUOTE(DISPLAY_NAME),QUOTE(JOIN(DISPLAY_NAME,Multi))] select _multiLine);