Skip to content

Commit

Permalink
Item Context Menu - Change option selection to Single click instead o…
Browse files Browse the repository at this point in the history
…f Double click (#1486)

Co-authored-by: jonpas <jonpas33@gmail.com>
  • Loading branch information
10Dozen and jonpas committed Sep 7, 2023
1 parent 9ac1bd7 commit 0796c26
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions addons/ui/fnc_openItemContextMenu.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,17 @@ _list setVariable [QFUNC(activate), {
};
}];

_list ctrlAddEventHandler ["lbDblClick", {
params ["_list"];
_this call (_list getVariable QFUNC(activate));
_list ctrlAddEventHandler ["LBSelChanged", {
[{
params ["_list"];
_this call (_list getVariable QFUNC(activate));
}, _this] call CBA_fnc_execNextFrame;
}];

_list ctrlAddEventHandler ["KeyDown", {
params ["_list", "_key"];
if (_key in [DIK_RETURN, DIK_NUMPADENTER]) then {
[_list getVariable QFUNC(activate), [_list, lbCurSel _list]] call CBA_fnc_execNextFrame;

// Set focus on background to prevent the inventory menu from auto closing.
ctrlSetFocus (ctrlParent _list displayCtrl IDC_FG_GROUND_TAB);
};
params ["", "_key"];
// keyboard's Up/Down events intercepted to prevent LBSelChanged event
if !(_key in [DIK_UP, DIK_DOWN]) exitWith {};
true
}];

// ---
Expand Down

0 comments on commit 0796c26

Please sign in to comment.