Hi,
SetGadgetItemData and GetGadgetItemData doesn't run properly in the LisIcon when I use it with PureLVSORT library (PureLVSORT_SelectGadgetToSort).
Look at the next piece of code. Comment and uncomment the marked lines and look at the effect.
Code: Select all
#CONTIS = 1
#LI0 = 2
#BTN = 3
; This code uses SetGadgetItemData to store the user data
; of each item to later know it, even if the items index changed.
;
If OpenWindow(0, 0, 0, 280, 350, "SetGadgetItemData", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget(#BTN, 190, 10, 80, 20, "Test")
ContainerGadget(#CONTIS, 0, 100, 280, 350, #PB_Container_Raised)
;- ListIcon de Usuarios
ListIconGadget(#LI0, 0, 0, 280, 250, "Name", 150,#PB_ListIcon_CheckBoxes|#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
CloseGadgetList()
;****** Comment and Uncomment the next two lines in order to show the effect ****
If PureLVSORT_SelectGadgetToSort(#LI0, #PureLVSORT_ShowClickedHeader_IconLeft) = #PureLVSORT_Ok
EndIf
;********************************************************************************
;-- Add row
AddGadgetItem(#LI0, CountGadgetItems(#LI0),"1")
SetGadgetItemData(#LI0,CountGadgetItems(#LI0)-1,100)
;-- Add row
AddGadgetItem(#LI0, CountGadgetItems(#LI0),"2")
SetGadgetItemData(#LI0,CountGadgetItems(#LI0)-1,200)
;-- Add row
AddGadgetItem(#LI0, CountGadgetItems(#LI0),"3")
SetGadgetItemData(#LI0,CountGadgetItems(#LI0)-1,300)
;-- Add row
AddGadgetItem(#LI0, CountGadgetItems(#LI0),"4")
SetGadgetItemData(#LI0,CountGadgetItems(#LI0)-1,400)
;-- Add row
AddGadgetItem(#LI0, CountGadgetItems(#LI0),"5")
SetGadgetItemData(#LI0,CountGadgetItems(#LI0)-1,500)
;-- Add row
AddGadgetItem(#LI0, CountGadgetItems(#LI0),"6")
SetGadgetItemData(#LI0,CountGadgetItems(#LI0)-1,600)
Repeat
Event = WaitWindowEvent()
If Event = #PB_Event_Gadget
If EventGadget() = #BTN
Debug GetGadgetItemData(#LI0, GetGadgetState(#LI0))
EndIf
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
Regards