Dave,
It has been a while on … just recently i revisited this routine and found that it was not working for some reason.
my routine does change the row color via CellBackgroundPaint, but then whites it out again. I set a default color as &cffffff ( white ) … if i don’t set a default my routines will produce a black row highlight.
put simply, i loading a window which on “open” loads data into a ListBox with 8 columns… then i change the background of each row based on the data … white, red, and pink.
hopefully someone can spot where my error is …
CellBackGroundPaint
[code]If row Mod 2 = 0 Then
g.ForeColor = &cf3f6fA
g.FillRect(0, 0, g.Width, g.Height)
End If
if row = currentRow Then
g.ForeColor = currentColor
g.FillRect(0, 0, g.Width, g.Height)
end if[/code]
Open Event For Window
[code]Dim iniFolder As FolderItem = MainWin.DataFolder.Child(“inv”).Child(MainWin.ItemCode.Text + “.inv”)
Dim r As Integer
currentColor = &cffffff
if iniFolder <> Nil and iniFolder.Exists Then
ListBoxLoadFromFile(Inventory, iniFolder, 8)
End if
for r = 0 to Inventory.ListCount - 1
currentRow = r
currentColor = CheckItemUsedStatus(Inventory, r)
//Inventory.InvalidateCell(r, 0)
msgbox "row: " + str® + " currentColor: " + str(currentColor)
next r
[/code]
CheckItemUsedStatus
[code]Dim qtybc, soldbc As Integer
Dim usedrow As Integer
qtybc = Val(iBox.Cell(row, 3))
soldbc = Val(iBox.Cell(row, 7))
If qtybc = soldbc Then ’ PINK
return &ce6b6e7
ElseIf soldbc > qtybc Then ’ RED
return &cffb389
Elseif qtybc < soldbc then ’ WHITE
return &cffffff
end If
// default return white
return &cffffff
[/code]