Arma 3 Scripting

Command in GUI Control - ListBox

lbSortBy

Also available as Markdown and JSON, or read the original wiki page.

Description

Sorts given ListBox by either lbText, lbValue or lbData in normal or reversed order, using case-sensitive or case-insensitive comparison. This command supports UNICODE characters. When sorting by "VALUE", the rows with the same lbValue will additionally be sorted by lbText in the order specified by reversedOrder flag, text specified by useTextRight flag and case-sensitivity specified by caseSensitive flag.

Important

  • This command supports referencing control via IDC as well, but as with any use of IDC in UI Control commands, a dialog should be present, i.e. UI user interaction is created with createDialog rather than createDisplay.
  • As this command supports UNICODE by default, which may result in slower sorting, you can switch it off with unicodeOff param.

Syntax

controlOrIDC lbSortBy [sortByType, reversedOrder, caseSensitive, useTextRight, unicodeOff]

Parameters:

Returns: Nothing

Examples

Example 1

with uiNamespace do
{
    private _lb = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscListBox", -1];
    _lb ctrlSetPosition [0,0,1,1];
    _lb ctrlCommit 0;
    lbClear _lb;
    {
        _lb lbAdd (_x select 0);
        _lb lbSetValue [_forEachIndex, _x select 1];
    }
    forEach [["В",1], ["Я",0], ["Б",1], ["Ю",0], ["А",1]];
    _lb lbSortBy ["VALUE", false, false];
};

See also

lnbSortBy · lnbSort · lnbSortByValue · lbSort · lbSortByValue · tvSort · tvSortByValue · sort