lnbSortBy: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
Line 1: Line 1:
{{RV|type=command
{{RV|type=command


|arma 3
|game1= arma3
|version1= 2.06


|2.06
|gr1= GUI Control - ListNBox


|gr1= GUI Control - ListNBox
|branch= dev


|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 <i>lnbSortXXX</i> commands, this command supports Unicode characters out of the box. The `sortByType` option is one of <tt>"TEXT"</tt>, <tt>"VALUE"</tt> or <tt>"DATA"</tt>. When sorting by <tt>"VALUE"</tt>, the rows with the same [[lnbValue]] will additionally be sorted by [[lnbText]] in the order specified by `reversedOrder` flag.  
|descr= 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.<br>
When sorting by <tt>"VALUE"</tt>, the rows with the same [[lnbValue]] will additionally be sorted by [[lnbText]] in the order specified by the ''reversedOrder'' flag.


{{Feature|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]]}}
{{Feature|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]]}}


| [controlOrIDC, column] '''lnbSortBy''' [sortByType, reversedOrder, caseSensitive]
|s1= [controlOrIDC, column] [[lnbSortBy]] [sortByType, reversedOrder, caseSensitive]
 
|p1= [controlOrIDC, column]: [[Array]]
 
|p2=  controlOrIDC: [[Control]] or [[Number]] - the ListNBox control or its IDC


|p3column: [[Number]] - column to sort (starts with 0)
|p1controlOrIDC: [[Control]] or [[Number]] - the ListNBox control or its IDC


|p4= [sortByType, reversedOrder, caseSensitive]: [[Array]]
|p2= column: [[Number]] - column to sort (starts with 0)


|p5= sortByType (Optional): [[String]] - one of <tt>"TEXT"</tt>, <tt>"VALUE"</tt> or <tt>"DATA"</tt>. Default: <tt>"TEXT"</tt>
|p3= sortByType: [[String]] - (Optional, default "TEXT") one of:
* <tt>"TEXT"</tt>
* <tt>"VALUE"</tt>
* <tt>"DATA"</tt>


|p6= reversedOrder (Optional): [[Boolean]] - [[true]] for sorting in reversed order. Default: [[false]]
|p4= reversedOrder: [[Boolean]] - (Optional, default [[false]]) [[true]] for sorting in reversed order


|p7= caseSensitive (Optional): [[Boolean]] - [[true]] for using case-sensitive comparison. Default: [[false]]
|p5= caseSensitive: [[Boolean]] - (Optional, default [[false]]) [[true]] for using case-sensitive comparison


| [[Nothing]]
|r1= [[Nothing]]


|x1= <code>[[with]] [[uiNamespace]] [[do]]
|x1= <code>[[with]] [[uiNamespace]] [[do]]
{
{
[[private]] _column = 1;
[[private]] _column = 1;
lnb = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty" [[ctrlCreate]] ["RscListNBox", -1];  
[[private]] _lnb = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty" [[ctrlCreate]] ["RscListNBox", -1];  
lnb [[ctrlSetPosition]] [0,0,1,1];  
_lnb [[ctrlSetPosition]] [0,0,1,1];  
lnb [[ctrlCommit]] 0;  
_lnb [[ctrlCommit]] 0;  
[[lnbClear]] lb;  
[[lnbClear]] _lnb;
{  
{  
lnb [[lnbAddRow]] <nowiki>[</nowiki>[[format]] ["Row %1", [[_forEachIndex]]], _x select 0];  
_lnb [[lnbAddRow]] [<nowiki/>[[format]] ["Row %1", [[_forEachIndex]]], _x select 0];  
lnb [[lnbSetValue]] <nowiki>[[</nowiki>[[_forEachIndex]], _column], _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, _column] [[lnbSortBy]] ["VALUE", [[true]], [[false]]];
[_lnb, _column] [[lnbSortBy]] ["VALUE", [[true]], [[false]]];
};</code>
};</code>


|seealso= [[lbSortBy]], [[lnbSort]], [[lnbSortByValue]], [[lbSort]], [[lbSortByValue]], [[tvSort]], [[tvSortByValue]], [[sort]]
|seealso= [[lbSortBy]], [[lnbSort]], [[lnbSortByValue]], [[lbSort]], [[lbSortByValue]], [[tvSort]], [[tvSortByValue]], [[sort]]
}}
}}
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
{{GameCategory|arma3|Scripting Commands}}

Revision as of 14:27, 21 May 2021

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

Description

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.
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
Groups:
GUI Control - ListNBox

Syntax

Syntax:
[controlOrIDC, column] lnbSortBy [sortByType, reversedOrder, caseSensitive]
Parameters:
controlOrIDC: Control or Number - the ListNBox control or its IDC
column: Number - column to sort (starts with 0)
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
Return Value:
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]; };

Additional Information

See also:
lbSortBylnbSortlnbSortByValuelbSortlbSortByValuetvSorttvSortByValuesort

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