But I nned the current sorted column and the sort direction in order to use the PureLVSORT_SortListIconNow() function !
That's my goal.
Consider this piece of code :
Code:
#WindowTimbres = 0
#ListIconTimbres = 0
#ButtonReload = 1
Procedure OpenWindow_WindowTimbres()
If OpenWindow(#WindowTimbres, 120, 229, 1024, 529, "Timbres", #PB_Window_SystemMenu|#PB_Window_SizeGadget|#PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered)
ButtonGadget(#ButtonReload, 905, 60, 115, 30, "Reload")
ListIconGadget(#ListIconTimbres, 5, 60, 895, 465, "Pays", 200, #PB_ListIcon_AlwaysShowSelection|#PB_ListIcon_FullRowSelect|#PB_ListIcon_GridLines)
PureCOLOR_SetWindowColor(#WindowTimbres, $FFFFF3)
PureLVSORT_SelectGadgetToSort(#ListIconTimbres, #PureLVSORT_ShowClickedHeader_IconLeft)
EndIf
EndProcedure
Procedure LoadGrid()
ClearGadgetItems(#ListIconTimbres)
AddGadgetItem(#ListIconTimbres, -1, "B")
AddGadgetItem(#ListIconTimbres, -1, "A")
AddGadgetItem(#ListIconTimbres, -1, "C")
MessageRequester("LVSORTTest", "PureLVSORT_GetClickedColumn :" + Str(PureLVSORT_GetClickedColumn(#ListIconTimbres)))
MessageRequester("LVSORTTest", "PureLVSORT_GetSortingDirection :" + Str(PureLVSORT_GetSortingDirection(#ListIconTimbres)))
EndProcedure
OpenWindow_WindowTimbres()
LoadGrid()
Repeat
ev = WaitWindowEvent()
If ev = #PB_Event_Gadget
If EventGadget() = #ButtonReload
LoadGrid()
EndIf
EndIf
Until ev = #PB_Event_CloseWindow
- Run it.
- Sort the column.
- Reload the grid by clicking the button.
- The two functions returns, respectively, -1 and zero : why ?
EDIT : I just found the answer : I must call the two functions BEFORE the ClearGadgetItems function...
Thanx anyway, gnozal.