Hi KCC

The next should satisfy your requirement (I hope)
You can colorize any item with any colors
Enable selecting color in the next ROUND

Code: Select all
#TV_FIRST = $1100
#TVM_MAPACCIDTOHTREEITEM = (#TV_FIRST + 42)
#TVM_MAPHTREEITEMTOACCID = (#TV_FIRST + 43)
Global selitem,selitem2
Procedure winCB(hWnd, uMsg, wParam, lParam)
Protected result, row
Protected *TVCDHeader.NMTVCUSTOMDRAW
result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_NOTIFY
*pnmh.NMHDR = lParam
Select *pnmh\code
Case #NM_CUSTOMDRAW
*TVCDHeader.NMTVCUSTOMDRAW = lParam
Select *TVCDHeader\nmcd\dwDrawStage
Case #CDDS_PREPAINT
result = #CDRF_NOTIFYITEMDRAW
Case #CDDS_ITEMPREPAINT
row = *TVCDHeader\nmcd\dwItemSpec
If row = selitem Or row = selitem2
*TVCDHeader\clrTextBk = $00FF00
*TVCDHeader\clrText = $0000FF
Else
*TVCDHeader\clrTextBk = $FFFFFF
*TVCDHeader\clrText = $FF0000
EndIf
If *TVCDHeader\nmcd\uItemState & #CDIS_SELECTED
*TVCDHeader\clrTextBk = $F39502
*TVCDHeader\clrText = $FFFFFF
EndIf
result = #CDRF_DODEFAULT
EndSelect
EndSelect
EndSelect
ProcedureReturn result
EndProcedure
OpenWindow(0, 0, 0, 400, 500, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetWindowColor(0,0)
ExplorerTreeGadget(0, 10, 10, 380, 480, "c:\*.*", #PB_Explorer_AlwaysShowSelection)
selitem = SendMessage_(GadgetID(0), #TVM_MAPACCIDTOHTREEITEM,10,0)
selitem2 = SendMessage_(GadgetID(0), #TVM_MAPACCIDTOHTREEITEM,11,0)
SetWindowCallback(@winCB())
SetActiveGadget(0)
;InvalidateRect_(GadgetID(0),0,1)
Repeat
Select WaitWindowEvent(1)
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1