mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-16 06:05:58 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@10795 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
1f0ecc2c7d
commit
3d85689bec
3 changed files with 38 additions and 1 deletions
26
reference/ArrayCtrlSorting/main.cpp
Normal file
26
reference/ArrayCtrlSorting/main.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include <CtrlLib/CtrlLib.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
ArrayCtrl list;
|
||||
|
||||
list.AddColumn("Column1").Sorting(); // default sorting
|
||||
list.AddColumn("Column2") // we provide compare function that sorts based on string length
|
||||
.Sorting([](const Value& a, const Value& b) -> int {
|
||||
return SgnCompare(AsString(a).GetCount(), AsString(b).GetCount());
|
||||
});
|
||||
|
||||
list.Add("Not sorted");
|
||||
|
||||
for(int i = 0; i < 100; i++)
|
||||
list.Add((int)Random(), (int)Random(), (int)Random());
|
||||
|
||||
list.SortingFrom(1);
|
||||
|
||||
TopWindow win;
|
||||
win.Add(list.SizePos());
|
||||
|
||||
win.Run();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue