lnbSortBy: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 31: Line 31:
|x1= <code>[[with]] [[uiNamespace]] [[do]]
|x1= <code>[[with]] [[uiNamespace]] [[do]]
{
{
[[private]] _column = 1;
lnb = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty" [[ctrlCreate]] ["RscListNBox", -1];  
lnb = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty" [[ctrlCreate]] ["RscListNBox", -1];  
lnb [[ctrlSetPosition]] [0,0,1,1];  
lnb [[ctrlSetPosition]] [0,0,1,1];  
Line 36: Line 37:
[[lnbClear]] lb;  
[[lnbClear]] lb;  
{  
{  
lnb [[lnbAddRow]] ["",_x select 0];  
lnb [[lnbAddRow]] <nowiki>[</nowiki>[[format]] ["Row %1", [[_forEachIndex]]], _x select 0];  
lnb [[lnbSetValue]] <nowiki>[[</nowiki>[[_forEachIndex]], 1], _x [[select]] 1];   
lnb [[lnbSetValue]] <nowiki>[[</nowiki>[[_forEachIndex]], _column], _x [[select]] 1];   
}  
}  
[[forEach]] [["В",1],["Я",0],["Б",1],["Ю",0],["А",1]];  
[[forEach]] [["В",1],["Я",0],["Б",1],["Ю",0],["А",1]];  
[lnb, 1] [[lnbSortBy]] ["VALUE", [[true]], [[false]]];
[lnb, _column] [[lnbSortBy]] ["VALUE", [[true]], [[false]]];
};</code>
};</code>



Revision as of 10:07, 16 May 2021

Hover & click on the images for description

Description

Description:
Description needed
Groups:
GUI Control - ListNBox

Syntax

Syntax:
Syntax needed
Parameters:
[controlOrIDC, column]: Array
controlOrIDC: Control or Number - the listNBox control or its IDC
column: Number - column to sort (starts with 0)
[sortByType, reversedOrder, caseSensitive]: Array
sortByType (Optional): String - one of "TEXT", "VALUE" or "DATA". Default: "TEXT"
reversedOrder (Optional): Boolean - true for sorting in reversed order. Default: false
caseSensitive (Optional): Boolean - true for using case-sensitive comparison. Default: false
Return Value:
Return value needed

Examples

Example 1:
with uiNamespace do { private _column = 1; lnb = findDisplay 46 createDisplay "RscDisplayEmpty" ctrlCreate ["RscListNBox", -1]; lnb ctrlSetPosition [0,0,1,1]; lnb ctrlCommit 0; lnbClear lb; { 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]; };

Additional Information

See also:
lnbSortlnbSortByValuelbSortlbSortByValuetvSorttvSortByValuesort

Notes

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