Difference between revisions of "lbSortBy"

From Bohemia Interactive Community
Jump to navigation Jump to search
(Created page with "{{RV|type=command |arma 3 |2.06 |gr1= GUI Control - ListBox |Sorts given ListBox by either lbText, lbValue or lbData in normal or reversed order, using case-se...")
 
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 - ListBox
  
|gr1= GUI Control - ListBox
+
|branch= dev
  
|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. 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 [[lbValue]] will additionally be sorted by [[lbText]] in the order specified by `reversedOrder` flag.  
+
|descr= 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 <tt>"VALUE"</tt>, the rows with the same [[lbValue]] will additionally be sorted by [[lbText]] in the order specified by `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 '''lbSortBy''' [sortByType, reversedOrder, caseSensitive]
+
|s1= controlOrIDC [[lbSortBy]] [sortByType, reversedOrder, caseSensitive]
  
 
|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]: [[Array]]
+
|p2= sortByType: [[String]] -  (Optional, default "TEXT") one of:
 +
* <tt>"TEXT"</tt>
 +
* <tt>"VALUE"</tt>
 +
* <tt>"DATA"</tt>
  
|p3= sortByType (Optional): [[String]] - one of <tt>"TEXT"</tt>, <tt>"VALUE"</tt> or <tt>"DATA"</tt>. Default: <tt>"TEXT"</tt>
+
|p3= reversedOrder: [[Boolean]] - (Optional, default [[false]]) [[true]] for sorting in reversed order
  
|p4= reversedOrder (Optional): [[Boolean]] - [[true]] for sorting in reversed order. Default: [[false]]
+
|p4= caseSensitive: [[Boolean]] - (Optional, default [[false]]) [[true]] for using case-sensitive comparison
  
|p5= caseSensitive (Optional): [[Boolean]] - [[true]] for using case-sensitive comparison. Default: [[false]]
+
|r1= [[Nothing]]
 
 
| [[Nothing]]
 
  
 
|x1= <code>[[with]] [[uiNamespace]] [[do]]
 
|x1= <code>[[with]] [[uiNamespace]] [[do]]
 
{
 
{
lb = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty" [[ctrlCreate]] ["RscListBox", -1];  
+
[[private]] _lb = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty" [[ctrlCreate]] ["RscListBox", -1];
lb [[ctrlSetPosition]] [0,0,1,1];  
+
_lb [[ctrlSetPosition]] [0,0,1,1];
lb [[ctrlCommit]] 0;  
+
_lb [[ctrlCommit]] 0;
[[lbClear]] lb;  
+
[[lbClear]] _lb;
{  
+
{
  lb [[lbAdd]] (_x [[select]] 0);  
+
_lb [[lbAdd]] (_x [[select]] 0);
  lb [[lbSetValue]] <nowiki>[</nowiki>[[_forEachIndex]], _x [[select]] 1];  
+
_lb [[lbSetValue]] [<nowiki/>[[_forEachIndex]], _x [[select]] 1];
}  
+
}
[[forEach]] [["В",1],["Я",0],["Б",1],["Ю",0],["А",1]];  
+
[[forEach]] [["В",1], ["Я",0], ["Б",1], ["Ю",0], ["А",1]];
lb [[lbSortBy]] ["VALUE", [[false]], [[false]]];
+
_lb [[lbSortBy]] ["VALUE", [[false]], [[false]]];
 
};</code>
 
};</code>
  
 
|seealso= [[lnbSortBy]], [[lnbSort]], [[lnbSortByValue]], [[lbSort]], [[lbSortByValue]], [[tvSort]], [[tvSortByValue]], [[sort]]
 
|seealso= [[lnbSortBy]], [[lnbSort]], [[lnbSortByValue]], [[lbSort]], [[lbSortByValue]], [[tvSort]], [[tvSortByValue]], [[sort]]
 
}}
 
}}
 
 
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
 
{{GameCategory|arma3|Scripting Commands}}
 

Revision as of 13:22, 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 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.
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 - ListBox

Syntax

Syntax:
controlOrIDC lbSortBy [sortByType, reversedOrder, caseSensitive]
Parameters:
controlOrIDC: Control or Number - the ListBox control or its IDC
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 _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:
lnbSortBylnbSortlnbSortByValuelbSortlbSortByValuetvSorttvSortByValuesort

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