Arma 3 Scripting

Command in GUI Control - ListNBox

lnbSortBy

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

Description

Sorts given multi-column ListNBox in the given column by either lnbText, lnbValue or lnbData in normal or reversed order, using case-sensitive or case-insensitive comparison. Unlike the older lnbSortXXX commands, this command supports UNICODE characters out of the box.

When sorting by "VALUE", the rows with the same lnbValue will additionally be sorted by lnbText in the order specified by the 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, column] lnbSortBy [sortByType, reversedOrder, caseSensitive, useTextRight, unicodeOff]

Parameters:

Returns: Nothing

Examples

Example 1

with uiNamespace do
{
    private _column = 1;
    private _lnb = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscListNBox", -1];
    _lnb ctrlSetPosition [0,0,1,1];
    _lnb ctrlCommit 0;
    lnbClear _lnb;
    { 
        _lnb lnbAddRow [format ["Row %1", _forEachIndex], _x select 0];
        _lnb lnbSetValue [[_forEachIndex, _column], _x select 1];
    } 
    forEach [["В",1], ["Я",0], ["Б",1], ["Ю",0], ["А",1]];
    [_lnb, _column] lnbSortBy ["VALUE", true, false];
};

See also

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