Skip to content

Commit

Permalink
remember last filter, select first map (#1067)
Browse files Browse the repository at this point in the history
  • Loading branch information
commy2 authored Feb 17, 2019
1 parent aff64ec commit a9b2d08
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion addons/ui/fnc_initDisplayRemoteMissions.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ private _fnc_findMissions = {
_display setVariable [QGVAR(stockMissions), _stockMissions];

lbSort _ctrlMaps;
_ctrlMaps lbSetCurSel 0;

ctrlPosition _ctrlMissions params ["_left", "_top", "_width", "_height"];

private _ctrlSearch = _display ctrlCreate ["RscEdit", IDC_SEARCH];
Expand All @@ -34,6 +36,9 @@ _ctrlSearch ctrlSetPosition [
];
_ctrlSearch ctrlCommit 0;

private _filter = profileNamespace getVariable [QGVAR(Filter), ""];
_ctrlSearch ctrlSetText _filter;

private _ctrlSearchButton = _display ctrlCreate ["RscButtonSearch", IDC_SEARCH_BUTTON];
_ctrlSearchButton ctrlSetPosition [
_left + _width - 21 * GUI_GRID_W,
Expand Down Expand Up @@ -103,7 +108,15 @@ _display setVariable [QFUNC(filter), {
private _ctrlSearch = _display displayCtrl IDC_SEARCH;
private _ctrlMissions = _display displayCtrl IDC_SERVER_MISSION;

private _filter = toLower ctrlText _ctrlSearch;
private _filter = ctrlText _ctrlSearch;

if (_filter != profileNamespace getVariable [QGVAR(Filter), ""]) then {
profileNamespace setVariable [QGVAR(Filter), _filter];
saveProfileNamespace;
};

_filter = toLower _filter;

private _missions = _ctrlMissions getVariable QGVAR(missions);
private _stockMissions = _display getVariable QGVAR(stockMissions);
private _showStockMissions = profileNamespace getVariable [QGVAR(ShowStockMissions), true];
Expand Down

0 comments on commit a9b2d08

Please sign in to comment.