BUG!!!
Seems that you must define further images with values bigger than 1 or you'll corrupt the internal icons from PureLVSORT_SelectGadgetToSort(#Gadget_main_ListIcon8, #PureLVSORT_ShowClickedHeader_Icon) ...
Here's an example!
Code:
;/ Created with PureVisionXP v2.03
;/ Tue, 07 Dec 2004 14:00:35
;/ by Rui Carvalho
;-Global Variables and Constants
Global BubbleTipStyle.l:BubbleTipStyle=0
#PB_Image_BorderRaised =$1
;-Window Constants
Enumeration 1
#Window_main
EndEnumeration
#WindowIndex=#PB_Compiler_EnumerationValue
;-Gadget Constants
Enumeration 1
;Window_main
#Gadget_main_Panel2
#Gadget_main_Tab
#Gadget_main_ListIcon8
EndEnumeration
#Image_main_Tab=0 ;<-- 0 or 1 will make
#GadgetIndex=#PB_Compiler_EnumerationValue
If CreateImage(#Image_main_Tab,16,16)
StartDrawing(ImageOutput())
For a=1 To 200
Plot(Random(16),Random(16))
Next
EndIf
;-StatusBar Constants
Enumeration 1
#StatusBar_main
#StatusBar_main_info1 =0
#StatusBar_main_info2 =1
EndEnumeration
#StatusBarIndex=#PB_Compiler_EnumerationValue
Procedure.l Window_main()
If OpenWindow(#Window_main,118,110,614,294,#PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered|#PB_Window_Invisible,"example")
If CreateGadgetList(WindowID(#Window_main))
PanelGadget(#Gadget_main_Panel2,0,5,615,250)
AddGadgetItem(#Gadget_main_Panel2,-1,"<empty>",UseImage(#Image_main_Tab))
ListIconGadget(#Gadget_main_ListIcon8,0,10,610,215,"client #",100,#PB_ListIcon_GridLines|#PB_ListIcon_FullRowSelect|#PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(#Gadget_main_ListIcon8,1,"reference #",200)
AddGadgetColumn(#Gadget_main_ListIcon8,2,"invoice #",90)
AddGadgetColumn(#Gadget_main_ListIcon8,3,"value",110)
AddGadgetColumn(#Gadget_main_ListIcon8,4,"date",80)
CloseGadgetList()
CreateStatusBar(#StatusBar_main,WindowID(#Window_main))
AddStatusBarField(200)
AddStatusBarField(300)
HideWindow(#Window_main,0)
ProcedureReturn WindowID()
EndIf
EndIf
EndProcedure
Global Color1.l, Color2.l, Tab_Count.l
Color1=RGB(224,235,255)
Color2=RGB(255,255,255)
Procedure WindowCallBack(WindowId,Message,wParam,lParam)
ReturnValue=#PB_ProcessPureBasicEvents
ReturnValue = PureLVSORT_CallBack(WindowId, Message, wParam, lParam, ReturnValue)
ReturnValue = PureCOLOR_CallBack(WindowId, Message, wParam, lParam, ReturnValue)
ProcedureReturn ReturnValue
EndProcedure
;-Main Loop
If Window_main()
PureCOLOR_SetGadgetColorEx(#Gadget_main_ListIcon8, RGB(0,0,0), Color1, Color2, #PureCOLOR_LV_AlternateColors)
If PureLVSORT_SelectGadgetToSort(#Gadget_main_ListIcon8, #PureLVSORT_ShowClickedHeader_Icon) = #PureLVSORT_Ok
PureLVSORT_SetColumnType(#Gadget_main_ListIcon8, 0, #PureLVSORT_Numeric)
PureLVSORT_SetColumnType(#Gadget_main_ListIcon8, 1, #PureLVSORT_Numeric)
PureLVSORT_SetColumnType(#Gadget_main_ListIcon8, 2, #PureLVSORT_Numeric)
PureLVSORT_SetColumnType(#Gadget_main_ListIcon8, 3, #PureLVSORT_String)
PureLVSORT_SetColumnType(#Gadget_main_ListIcon8, 4, #PureLVSORT_DateDDMMYYYY)
EndIf
SetWindowCallback(@WindowCallBack())
For a=1 To 100
AddGadgetItem(#Gadget_main_ListIcon8,-1,Str(Random(150000)))
Next
quitmain=0
Repeat
EventID=WaitWindowEvent()
Select EventID
Case #PB_Event_CloseWindow
If EventWindowID()=#Window_main
quitmain=1
EndIf
Case #PB_Event_Menu
Case #PB_Event_Gadget
Select EventGadgetID()
Case #Gadget_main_Tab
Case #Gadget_main_ListIcon8
Select EventType()
Case #PB_EventType_LeftDoubleClick
Case #PB_EventType_RightDoubleClick
Case #PB_EventType_RightClick
Default
EndSelect
EndSelect
EndSelect
Until quitmain
CloseWindow(#Window_main)
EndIf
End