Sorting a List
You can sort a list using the member function
IlvListGadgetItemHolder::sort, which takes a comparison function as a parameter. If you do not provide your own comparison function, the virtual member function
IlvListGadgetItemHolder::compareItems is used. This method simply uses the
strcmp function to compare two strings and returns the result of the comparison.
If you want to use another function, you can either specify it in the call to sort or redefine the compareItems member function in your subclass of IlvListGadgetItemHolder.
The following is an example of a list compare function that sorts items in descending order:
int MyCompareFunction(const char* string1,
const char* string2,
IlvAny,
IlvAny)
{
return -strcmp(string1, string2);
}
Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.