Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make import editbox resize while editing it #860

Merged
merged 2 commits into from
Dec 29, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 33 additions & 4 deletions addons/settings/fnc_gui_export.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,39 @@ if (_mode == "import") then {
};
};

private _position = ctrlPosition _ctrlValue;
_position set [3, (ctrlTextHeight _ctrlValue) + (_position select 3)];
_ctrlValue ctrlSetPosition _position;
_ctrlValue ctrlCommit 0;
private _fnc_updateSize = {
params ["_display"];
private _ctrlValueGroup = _display displayCtrl IDC_EXPORT_VALUE_GROUP;
private _ctrlValue = _display displayCtrl IDC_EXPORT_VALUE;

private _config = configFile >> QGVAR(export)
>> "controls" >> ctrlClassName ctrlParentControlsGroup _ctrlValueGroup
>> "controls" >> ctrlClassName _ctrlValueGroup
>> "controls" >> ctrlClassName _ctrlValue;

private _minHeight = getNumber (_config >> "h");
private _lineHeight = getNumber (_config >> "sizeEx");

private _position = ctrlPosition _ctrlValue;
_position set [3, (ctrlTextHeight _ctrlValue + 2*_lineHeight) max _minHeight];
_ctrlValue ctrlSetPosition _position;
_ctrlValue ctrlCommit 0;

// auto scroll
private _text = ctrlText _ctrlValue;
private _prevText = _ctrlValue getVariable [QGVAR(prevText), _text];
_ctrlValue setVariable [QGVAR(prevText), _text];

if (_text != _prevText && {_ctrlValue ctrlSetText _text; _text find _prevText == 0}) then {
_ctrlValueGroup ctrlSetAutoScrollSpeed 0.00001;
_ctrlValueGroup ctrlSetAutoScrollDelay 0;
} else {
_ctrlValueGroup ctrlSetAutoScrollSpeed -1;
};
};

_display displayAddEventHandler ["MouseMoving", _fnc_updateSize];
_display displayAddEventHandler ["MouseHolding", _fnc_updateSize];

_ctrlCancel ctrlAddEventHandler ["ButtonClick", {
params ["_control"];
Expand Down
2 changes: 1 addition & 1 deletion addons/settings/gui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ class GVAR(export) {
x = POS_W(0);
y = POS_H(0);
w = POS_W(29);
h = POS_H(0.8);
h = POS_H(29);
sizeEx = POS_H(0.8);
};
};
Expand Down