Home » U++ Library support » U++ Widgets - General questions or Mixed problems » ColumnList question (sort column)
Re: ColumnList question (sort column) [message #2913 is a reply to message #2898] |
Sat, 29 April 2006 22:58   |
 |
mirek
Messages: 14261 Registered: November 2005
|
Ultimate Member |
|
|
forlano wrote on Sat, 29 April 2006 05:32 | Hello,
I have put my data in a columnlist widget and I would like to see them sorted alphabetically (it does not matter if during the insertion or at the end). The syntax to do it is:
Sort(const ValueOrder& order)
but I was unable fo find an example that shows how to set this argument.
Thank you,
Luigi
|
[/code]
struct ValueOrder {
virtual bool operator()(const Value& a, const Value& b) const = 0;
};
struct StdValueOrder : ValueOrder {
int language;
virtual bool operator()(const Value& a, const Value& b) const;
StdValueOrder(int l = -1);
virtual ~StdValueOrder();
};
struct FnValueOrder : ValueOrder {
int (*fn)(const Value& a, const Value& b);
virtual bool operator()(const Value& a, const Value& b) const;
FnValueOrder(int (*fn)(const Value& a, const Value& b));
virtual ~FnValueOrder();
};
[/code]
Use "StdValueOrder()" in place of ValueOrder if you expect the "normal" ordering and content of columnlist consists of "Std" values (number, String, Date, Time).
list.Sort(StdValueOrder());
If you need something special, you can either create comparison function and use FnValueOrder, or you can derive ValueOrder and provide new operator().
Mirek
|
|
|
Goto Forum:
Current Time: Fri Jun 06 11:02:35 CEST 2025
Total time taken to generate the page: 0.04509 seconds
|