Page 4 of 4
Re: Sort ListIconGadget [Windows only]
Posted: Mon Mar 03, 2025 2:43 pm
by Zapman
dcr3 wrote: Mon Mar 03, 2025 1:01 pm
I haven't tested everything thoroughly in this sort module.
Many thanks to continuing to test, dcr3. That's great!
How do you proceed to test different formats? If I just do:
Global CSLI_DateFormat$ = "%yyyy-%mm-%dd"
instead of
Global CSLI_DateFormat$ = GetLocalDateFormat()
All is OK for me.
Re: Sort ListIconGadget [Windows only]
Posted: Mon Mar 03, 2025 4:34 pm
by dcr3
May be something like this.It's your call.
Global Dim dates.s(4)
Global CSLI_DateFormat$
Select CSLI_DateFormat$
Case dates(0)
CSLI_DateFormat$="%dd.%mm.%yyyy"
Case dates(1)
CSLI_DateFormat$="%dd-%mm-%yyyy"
Case dates(2)
CSLI_DateFormat$="%dd/%mm/%yyyy"
Case dates(3)
CSLI_DateFormat$="%yyyy.%mm.%dd"
Case dates(4)
CSLI_DateFormat$="%yyyy/%mm/%dd"
Case dates(5)
etc:..
Re: Sort ListIconGadget [Windows only]
Posted: Mon Mar 03, 2025 6:26 pm
by Zapman
dcr3 wrote: Mon Mar 03, 2025 4:34 pm
May be something like this.It's your call.
Global Dim dates.s(4)
Global CSLI_DateFormat$
Select CSLI_DateFormat$
Case dates(0)
CSLI_DateFormat$="%dd.%mm.%yyyy"
Case dates(1)
CSLI_DateFormat$="%dd-%mm-%yyyy"
Case dates(2)
CSLI_DateFormat$="%dd/%mm/%yyyy"
Case dates(3)
CSLI_DateFormat$="%yyyy.%mm.%dd"
Case dates(4)
CSLI_DateFormat$="%yyyy/%mm/%dd"
Case dates(5)
etc:..
Sorry, dcr3, I probably don't understand what you mean

Line 205, instead of doing
Code: Select all
Global CSLI_DateFormat$ = GetLocalDateFormat()
I did that:
Code: Select all
Global CSLI_DateFormat$
Define Test = 5
Select Test
Case 1
CSLI_DateFormat$="%dd.%mm.%yyyy"
Case 2
CSLI_DateFormat$="%dd-%mm-%yyyy"
Case 3
CSLI_DateFormat$="%dd/%mm/%yyyy"
Case 4
CSLI_DateFormat$="%yyyy.%mm.%dd"
Case 5
CSLI_DateFormat$="%yyyy/%mm/%dd"
EndSelect
and everything works perfectly, whatever the value (from1 to 5), i give to 'Test'.
Re: Sort ListIconGadget [Windows only]
Posted: Thu Mar 06, 2025 4:04 am
by Amundo
Thank you very much, Zapman, for sharing your nicely laid-out code.
I too, was using Nalor's module but decided to try using your one. The issue I have, is that I'm not quite sure how to handle a ListIcon gadget which gets refreshed (oddly enough, by the user clicking a "Refresh" button). Should I be trying to extract the last column selected from the "CSLI_WinLIProc" callback procedure?
(In other words, how can I know which column the user is currently sorting on and which direction, repopulate the ListIcon with new data, then reapply the same sort parameters?)
Thanks in advance for any advice,
Amundo
Re: Sort ListIconGadget [Windows only]
Posted: Thu Mar 06, 2025 10:50 am
by Zapman
Amundo wrote: Thu Mar 06, 2025 4:04 amhow can I know which column the user is currently sorting on and which direction
Hi, Amundo.
Thank you for the test and for the need reporting.
The 'SortListIcon()' is called by the library to sort the gadget when the user clicks on a column title, and you can also call it to sort the gadget the way you want.
I have updated the code proposed in the first post of this subject to answer to your need. The version 'March 2025-3' offers to additionnal procedures:
- GetLastSortingColumn(GadgetNum)
- GetLastSortingAscentDescent(GadgetNum)
You can call them to get the parameters used to do the last gadget's sorting:
Code: Select all
LastColumn = GetLastSortingColumn(GadgetNum)
LastAscentDescent = GetLastSortingAscentDescent(GadgetNum)
and eventually reuse them by calling
Code: Select all
SortListIcon(GadgetNum, LastColumn, LastAscentDescent)
I hope this meets your need. Let me know if it doesn't.
This version of the library has also an improved version of the procedure 'RemoveAccents()' which is now very efficient. It is 400 times faster than the preceeding version!
Re: Sort ListIconGadget [Windows only]
Posted: Mon Mar 10, 2025 1:33 am
by Amundo
Thank you, Zapman, your additions are just what the doctor ordered - it's perfect!
My program's almost like a bought one now
Thanks again,
Amundo