Hi,
I am at the point of sorting my listview and I need to implement a custom sort function too...
How does one mark the column the listview is sorted by?( Where do the arrows come from?)
Is there an easy way to reverse ordering?
How hard would it be to teach MUI handle integer different(compared to string)?
MUI Royale currently doesn't support the arrows but this is planned for the future.
Reverse sorting is really easy. Just write a callback which uses the "<" or ">" operator to compare strings alphabetically and then return -1, 0, or 1. See here: Listview.SortFunc
I have to rephrase:
Is there some function/memory available to get to know the state of a listview/column?
Where does one find out how the listview is sorted and in which direction the sort was done?
Do I have to implement state on my own or is there another way to know which sortfunction to call?
Since you have to implement sorting entirely on your own, there's no state you could query. How the entries are sorted is entirely determined by the way your sort function is implemented. The Listview doesn't even know that it is displaying sorted contents. It's all managed by your sort function.
@DISPLAY {Hidden = True}
Function p_CompareFunc(msg)
If msg.entry1[0] > msg.entry2[0] Then Return(-1)
If msg.entry1[0] = msg.entry2[0] Then Return(0)
Return(1)
EndFunction
Function p_EventFunc(msg)
Switch msg.action
Case "MUIRoyale":
Switch msg.attribute
Case "CloseRequest":
End
Case "Pressed":
mui.DoMethod("lv", "sort", 0)
EndSwitch
EndSwitch
EndFunction
mui.CreateGui(FileToString("sorttest.xml"))
InstallEventHandler({MUIRoyale = p_EventFunc})
Repeat
WaitEvent
Forever