Skip to content

Commit f11bbaa

Browse files
authored
Dialog - Fix multi-line edit box not displaying default text correctly (#618)
1 parent e95f989 commit f11bbaa

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

addons/dialog/functions/fnc_gui_edit.sqf

+10-10
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ params ["_controlsGroup", "_defaultValue", "_settings"];
2424
_settings params ["_fnc_sanitizeValue", "_isMulti", "_height"];
2525

2626
private _ctrlEdit = _controlsGroup controlsGroupCtrl IDC_ROW_EDIT;
27-
_ctrlEdit ctrlSetText _defaultValue;
27+
28+
// Adjust the height of multi-line edit boxes
29+
if (_isMulti) then {
30+
_controlsGroup ctrlSetPositionH POS_H(_height + 1);
31+
_controlsGroup ctrlCommit 0;
32+
33+
_ctrlEdit ctrlSetPositionH POS_H(_height);
34+
_ctrlEdit ctrlCommit 0;
35+
};
2836

2937
// Format text using sanitizing function whenever it is changed
3038
private _fnc_textChanged = {
@@ -38,15 +46,7 @@ private _fnc_textChanged = {
3846
_ctrlEdit ctrlAddEventHandler ["KeyDown", _fnc_textChanged];
3947
_ctrlEdit ctrlAddEventHandler ["KeyUp", _fnc_textChanged];
4048
_ctrlEdit setVariable [QGVAR(params), _fnc_sanitizeValue];
41-
42-
// Adjust the height of multi-line edit boxes
43-
if (_isMulti) then {
44-
_controlsGroup ctrlSetPositionH POS_H(_height + 1);
45-
_controlsGroup ctrlCommit 0;
46-
47-
_ctrlEdit ctrlSetPositionH POS_H(_height);
48-
_ctrlEdit ctrlCommit 0;
49-
};
49+
_ctrlEdit ctrlSetText _defaultValue;
5050

5151
_controlsGroup setVariable [QFUNC(value), {
5252
params ["_controlsGroup"];

0 commit comments

Comments
 (0)