View previous topic :: View next topic |
Author |
Message |
Csimbi I post too much Reputation: 92
Joined: 14 Jul 2007 Posts: 3102
|
Posted: Sun Apr 25, 2021 4:17 am Post subject: Sorting unsorted MemRec list or building sorted MemRec list |
|
|
Hi guys,
Say, I have 300 memrecs, all memrecs are of the same data type (UnicodeString).
It's hard to find a specific item so I would like to sort the list alphabetically (or, populate the list in alphabetic order in the first place) using the MemRec's actual value to do the sorting.
My basic questions are:
- How does one sort a list of MemRecs? (is there a qsort in CELUA?)
- How does one build a sorted list in the first place? (is there a "find spot then .InsertAt(x)" in CE?).
- Can I disable CE address list updates whilst the sorting is going on? (soft of beginEdit/endEdit but for sorting, to avoid CPU use for UI updates/flickering)
- Are there code templates/examples for either one these?
Thank you!
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sun Apr 25, 2021 5:38 am Post subject: |
|
|
get the treeview object of the addresslist (getComponent 0 or 1)
then you can do a treeview.beginUpdate()
As for sorting, rhere is currently no move capability so you'll have to rebuild the addresslist from scratch
Perhaps instead if sorting the addresslist you can create a new window with the list sorted there
lua supports table.sort which can be used to sort
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
Csimbi I post too much Reputation: 92
Joined: 14 Jul 2007 Posts: 3102
|
Posted: Sun Apr 25, 2021 11:41 am Post subject: |
|
|
Problem is, I need to sort nested MemRecs.
Looks a bit like below.
Meaning, the list is not flat - so the sorting in the new window might not do the trick.
Is this something you'd consider as a feature request?
Thank you!
Description: |
|
Filesize: |
17.15 KB |
Viewed: |
1387 Time(s) |
|
|
|
Back to top |
|
|
Dark Byte Site Admin Reputation: 457
Joined: 09 May 2003 Posts: 25262 Location: The netherlands
|
Posted: Sun Apr 25, 2021 4:59 pm Post subject: |
|
|
You could use a lua script that changes the description of all records at level 0 with their value and then sort by description
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
Back to top |
|
|
|