Hi, want to know if lb gadget can sort COLUMN1 and at same time COLUMN2 (dependig on COLUMN1).
I mean, having COL1=month and COL2=day in a lb, sort the list first by month (COL1) and then by day (COL2):
Month | Day ------+------ 1 | 2 1 | 8 2 | 10 2 | 20 ..
Or do I have to "cook" the code for such purpose?
TIA
@jabirulo
What you are requesting would require the listbrowser to rehash the physical pairing of values in the individual nodes - not just rearrange node order in the list. I don't think that is supported.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
@jabirulo
if I read the autodocs correctly the listnodes are always sorted first by their priority. If you set the LBNA_Priority of the listnodes to the month and sort by the day column should do what you want.
Hi, just tried 'LBNA_Priority,5' and don't seems to change anything (or possible that I'm doing it wrong) it just sorts by the day (DD) column, so maybe lb_gadget can't sort by itself "DD col inside MM col":
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
@jabirulo
Setting the priority to 5 will not change anything because it's the same for all nodes.
Try "LBNA_Priority,month" instead and only sort the day column.
GREAT!!! Changing to:
if( (n = IListBrowser->AllocListBrowserNode(TOTALCOLUMNS, LBNA_Priority,-month,..
makes sort month and DAY!!! Had to put '-' (negativ), 'cos sorting month were from 12..1 in listbrowser, but will try to use/add LBCIA_SortDirection if it makes a difference.
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
The correct way to do this is to provide a compare hook when setting up your LBColumnInfo.
LBCIA_CompareHook (struct Hook *)
The sort comparison hook to use on the column. This is
the exact same hook used by the LBM_SORT method. See
the LBM_SORT method documentation for more information.
This hook will only be used if the column is marked
sortable (see LBCIA_Sortable tag).
Defaults to NULL (default LBM_SORT comparison).
The Compare function can then compare nodes by whatever criteria you want.
THX, will try to do it the correct_way_TM ASAP.
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
Ok, just "playing" a bit with 'LBCIA_CompareHook,compare_hook,' just get to sort MM (month) column, but days still not sorted.
Is there someway to get current node 'compare_func()' is comparing, so I can get DD (day) and (re)sort in case Day_A < Day_B? All inside this same compare_func().
Or do I must to (re)sort DD "again" with another (almost identic) 'compare_func()'.
TIA
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
Without knowing what "blah, Blah" is it's hard to comment in definete detail, but for any given row you must surely be about to determine the month and day info?
You will need the userdata field of you node to point to some structure that holds the month and day info. Presumably whichever structure you created the row from in the first place.
Or perhaps you could set it to the datestamp of the entire row, depends a lot on the structure of your application.
As I'm just testing compare_func() hook is just now as simple as this (clone of LBM_SORT mode aprox.):
Ok, thx. I gueesed I have to use UserData field, maybe filled with the node or just the DD, so I can get the DD field and then re-sort again if needed. THX
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P