Prior to that, no combination of SetGadgetItemColor would work anywhere in my code.
Now that I know what killed it, I still don't know how to fix it.
Could someone smart person look over my window callback code and maybe suggest how I can prevent it from killing my colouring?
Code: Select all
Procedure MainWindowCallback(hWnd, uMsg, wParam, lParam)
Result = #PB_ProcessPureBasicEvents
; Netmaestro's windowsnap code
Static Snapped1.i, Snapped2.i, Snapped3.i, Snapped4.i
Select uMsg
; Netmaestro's windowsnap code
Case #WM_MOVING
If Toggle\ScreenSnap = 1
*view.RECT = lparam
curwidth = *view\right - *view\left
curheight = *view\bottom - *view\top
If AutoSnap ; AutoSnap Section
If *view\left < SnapD
If Not Snapped1
*view\left = 0
*view\right = curwidth
snapped1 = #True
ReturnValue = #True
EndIf
Else
snapped1 = #False
EndIf
If *view\top < SnapD
If Not Snapped2
*view\top = 0
*view\bottom = curheight
snapped2 = #True
ReturnValue = #True
EndIf
Else
snapped2 = #False
EndIf
If *view\right > screenw - SnapD
If Not Snapped3
*view\left = ScreenW - curwidth
*view\right = screenW
snapped3 = #True
ReturnValue = #True
EndIf
Else
snapped3 = #False
EndIf
If *view\bottom > screenH - SnapD
If Not Snapped4
*view\top = screenH - curheight
*view\bottom = screenH
snapped4 = #True
ReturnValue = #True
EndIf
Else
snapped4 = #False
EndIf
EndIf
If *view\top < 0 ; Inside Desktop Section
*view\top = 0
*view\bottom = curheight
EndIf
If *view\left < 0
*view\left = 0
*view\right = curwidth
EndIf
If *view\right > screenW
*view\right = screenW
*view\left = *view\right - curwidth
EndIf
If *view\bottom > screenH
*view\bottom = screenH
*view\top = *view\bottom - curheight
EndIf
MoveWindow_(WindowID, *view\left, *view\top, *view\right - *view\left, *view\bottom - *view\top, #True)
ReturnValue = #True
EndIf
; Draw a line through an item to indicate its deleted state
Case #WM_NOTIFY
*nmhdr.NMHDR = lParam
*lvCD.NMLVCUSTOMDRAW = lParam
If IsGadget(#Gadget_MyInfo_Titles)
If *lvCD\nmcd\hdr\hwndFrom = GadgetID(#Gadget_MyInfo_Titles) And *lvCD\nmcd\hdr\code = #NM_CUSTOMDRAW
Select *lvCD\nmcd\dwDrawStage
Case #CDDS_PREPAINT
result = #CDRF_NOTIFYITEMDRAW
Case #CDDS_ITEMPREPAINT
result = #CDRF_NOTIFYSUBITEMDRAW;
Case #CDDS_ITEMPREPAINT | #CDDS_SUBITEM
thisRow = *lvCD\nmcd\dwItemSpec
thisCol = *lvCD\iSubItem
on_off = GetGadgetItemData(#Gadget_MyInfo_Titles, thisRow)
; If thisCol = 0 And on_off. Specifically for column 0. You can change this to any or just use on_off to set all columns
If on_off
SelectObject_(*lvCD\nmcd\hdc, FontID(#FontStrikeoutYes))
result = #CDRF_NEWFONT; | #CDRF_DODEFAULT
Else
SelectObject_(*lvCD\nmcd\hdc, FontID(#FontStrikeoutNo))
result = #CDRF_NEWFONT
EndIf
; Proper colour banding in listicons. This would have worked in main code with SetGadgetItemColor
; if something else in this callback didn't kill it.
If Toggle\ColourBand = #True ;<-----------Add This Block (Paul Leischow)
If (thisRow / 2) * 2 = thisRow
;*lvCD\clrText = $000000
;*lvCD\clrTextBk = $D4D4D4
*lvCD\clrText = $000000
*lvCD\clrTextBk = $EEEEEE
Else
;*lvCD\clrText = $FFFFFF
;*lvCD\clrTextBk = $C1C1C1
*lvCD\clrText = $484848
*lvCD\clrTextBk = $DADADA
EndIf
EndIf
EndSelect
EndIf
EndIf
EndSelect ; uMsg
ProcedureReturn Result
EndProcedure