Hi, I juts build a listviewer/listbrowser with name+size and size is a string 'cos I'm adding thousands separator: "aaaa" "123.456"...
Building size->text_with_thousands_separator I use:
IUtility->SNPrintf(size_str, sizeof(size_str), "%lU", size); //using the locale's formatting conventions
So I get "123.456", but on lister to sort such column I must (or is there other way?) revert/remove the thousands separator char.
Now I use this ugly code:
uint32 val1, val2; char *txt1, *txt2; char tmp[20]; ... GetNodeData( obj, msg->Node1, msg->ColumnNr, LISTVIEWERN_Text,&txt1, TAG_END); //gets value from column ... int8 j = 0, k = 0; while(txt1[k] != '\0') { if( isdigit(txt1[k]) ) tmp[j++] = txt1[k]; ++k; } tmp[j] = '\0'; IDOS->StrToLong(&tmp, &val1); ...
Any other way to "undo" such thousands separator?
TiA
Maybe you could store the original integers as user data, and then sort on that instead of the formatted string?
@jabirulo
How about you store the size (= the actual number) in each node's user data, and when you need to sort according to size you compare that, instead of the node text?
EDIT: msteed beat me to it! :-)
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
@msteed & @trixie
thx will try such approach.
BTW I'm using AEON's listviewer as list browser.
EDIT1; worked like a charm, THX guys!!!!
Using (struct) lvNode->Value for storing integer size value and comparing/sorting using "retval = msg->Node1->Value - msg->Node2->Value;"
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P