From: Eckhard Sallermann on
Hi, the following code colours the "not selected" items, but the
selected items will not being colored, what?s wrong here ?

METHOD ControlNotify( oEvent ) CLASS winmain
LOCAL pNMCustomDraw as _WINNMLVCUSTOMDRAW
LOCAL dwDrawStage as DWORD
LOCAL dwItem as DWORD
LOCAL olvi as listviewitem
LOCAL strucLVCD as _WINNMLVCUSTOMDRAW
LOCAL dCode as DWORD


dCode := oEvent:NotifyCode

DO CASE
CASE dCode = NM_CUSTOMDRAW
pNMCustomDraw := ptr( _cast , oEvent:lParam )
dwDrawStage := pNMCustomDraw.nmcd.dwDrawStage
strucLVCD := ptr(_cast,oEvent:lParam)
DO CASE
CASE dwDrawStage = CDDS_PREPAINT
self:EventReturnValue := CDRF_NOTIFYITEMDRAW
CASE dwDrawStage = CDDS_ITEMPREPAINT
dwItem := pNMCustomDraw.nmcd.dwItemSpec
oLVI:=oEvent:Control:GetItemAttributes(strucLVCD.nmcd.dwItemSpec + 1 )

if _and ( strucLVCD.nmcd.uItemState , _or ( CDIS_FOCUS ,
CDIS_SELECTED ) ) == _or ( CDIS_FOCUS , CDIS_SELECTED )
do case
case olvi:gettext( #status) = "9 " .or. olvi:gettext( #status) = "0
" // Noch in Bearbeitung
pNMCustomDraw.clrText := RGB( 255 , 128 , 0 ) // Gelb
pNMCustomDraw.clrTextBk := RGB( 255 , 255 , 255 ) // Schwarz
case Val(olvi:gettext( #status)) = 0
pNMCustomDraw.clrText := RGB( 0 , 200 , 0 ) // Gr�n
otherwise
pNMCustomDraw.clrText := RGB( 255 , 0 , 0 ) // Rot
endcase

else
do case
case olvi:gettext( #status) = "9 " .or. olvi:gettext( #status) =
"0 " // Noch in Bearbeitung
pNMCustomDraw.clrText := RGB( 255 , 128 , 0 ) // Gelb
case Val(olvi:gettext( #status)) = 0
pNMCustomDraw.clrText := RGB( 0 , 200 , 0 ) // Gr�n
otherwise
pNMCustomDraw.clrText := RGB( 255 , 0 , 0 ) // Rot
endcase

endif
self:EventReturnValue := CDRF_NOTIFYITEMDRAW
OTHERWISE
self:EventReturnValue := CDRF_DODEFAULT
ENDCASE
SetWindowLong( self:Handle() , DWL_MSGRESULT , self:EventReturnValue )
RETURN self:EventReturnValue
ENDCASE
RETURN SUPER:ControlNotify(oEvent)