Difference between revisions of "lbSortBy"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " \| *(game[0-9]|version[0-9]|gr[0-9]|serverExec|mp|pr|descr|s[0-9]|p[0-9]{1,3}|r[0-9]|x1?[0-9]|seealso) *= +" to " |$1= ")
Line 15: Line 15:
|s1= controlOrIDC [[lbSortBy]] [sortByType, reversedOrder, caseSensitive, useTextRight]
|s1= controlOrIDC [[lbSortBy]] [sortByType, reversedOrder, caseSensitive, useTextRight]
|p1= controlOrIDC: [[Control]] or [[Number]] - the ListBox control or its IDC
|p1= controlOrIDC: [[Control]] or [[Number]] - the ListBox control or its IDC
|p2= [sortByType, reversedOrder, caseSensitive, useTextRight]: [[Array]]
|p2= [sortByType, reversedOrder, caseSensitive, useTextRight]: [[Array]]

Revision as of 22:21, 19 June 2021

Hover & click on the images for description
Only available in Development branch(es) until its release with Arma 3 patch v2.06.


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.
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
GUI Control - ListBox


controlOrIDC lbSortBy [sortByType, reversedOrder, caseSensitive, useTextRight]
controlOrIDC: Control or Number - the ListBox control or its IDC
[sortByType, reversedOrder, caseSensitive, useTextRight]: Array
sortByType: String - (Optional, default "TEXT") one of:
  • "TEXT"
  • "VALUE"
  • "DATA"
reversedOrder: Boolean - (Optional, default false) true for sorting in reversed order
caseSensitive: Boolean - (Optional, default false) true for using case-sensitive comparison
useTextRight: Boolean - (Optional, default false) true to sort by text right
Return Value:


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]; };

Additional Information

See also:


Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note