
I tested the example successfully with option "Enable modern theme support" both enabled and disabled on these Windows versions:
- Windows XP SP3 (PB 5.44 x86 in both ASCII and Unicode mode and PB 5.60 x86; works only with option "Enable modern theme support" disabled!)
- Windows 7 x86 SP1 (PB 5.44 x86 in both ASCII and Unicode mode and PB 5.60 x86)
- Windows 7 x64 SP1 (PB 5.44 x86 and x64 in both ASCII and Unicode mode and PB 5.60 x86 and x64)
- Windows 8.1 x64 (PB 5.44 x86 and x64 in both ASCII and Unicode mode and PB 5.60 x86 and x64)
Code: Select all
EnableExplicit
#HeaderTextColor = #Blue
#LVM_GETHEADER = #LVM_FIRST + 31
Define DefaultListIconCallback.I
Procedure CustomListIconCallback(WindowHandle.I, Msg.I, WParam.I, LParam.I)
Shared DefaultListIconCallback.I
Protected *NMCUSTOMDRAW.NMCUSTOMDRAW
Protected *NMHDR.NMHDR
Protected Result.I
Result = CallWindowProc_(DefaultListIconCallback, WindowHandle.I, Msg.I,
WParam.I, LParam.I)
If Msg = #WM_NOTIFY
*NMHDR = LParam
If *NMHDR\code = #NM_CUSTOMDRAW
*NMCUSTOMDRAW = LParam
Select *NMCUSTOMDRAW\dwDrawStage
Case #CDDS_PREPAINT
Result = #CDRF_NOTIFYITEMDRAW
Case #CDDS_ITEMPREPAINT
SetTextColor_(*NMCUSTOMDRAW\hdc, #HeaderTextColor)
EndSelect
EndIf
EndIf
ProcedureReturn Result
EndProcedure
OpenWindow(0, 200, 100, 400, 100, "ListIconGadget with colored header text")
ListIconGadget(0, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 20,
"Name", 110, #PB_ListIcon_GridLines)
AddGadgetColumn(0, 1, "Address", GadgetWidth(0) - GetGadgetItemAttribute(0, 0,
#PB_ListIcon_ColumnWidth) - 4)
AddGadgetItem(0, -1, "Harry Rannit" + #LF$ +
"12 Parliament Way, Battle Street, By the Bay")
AddGadgetItem(0, -1, "Ginger Brokeit" + #LF$ +
"130 PureBasic Road, BigTown, CodeCity")
AddGadgetItem(0, -1, "Didi Foundit" + #LF$ +
"321 Logo Drive, Mouse House, Downtown")
DefaultListIconCallback = SetWindowLongPtr_(GadgetID(0), #GWL_WNDPROC,
@CustomListIconCallback())
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow