I have the following CellBackGroundPaint code in a Listbox:
Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean
// Gradiant Fill
g.FillRectGradient 0, 0, g.Width, g.Height, LIST_GRADIENT_LOW, LIST_GRADIENT_HIGH
If column = 2 Then
If ccBackupSettings1.Visible Then
g.DrawPicture(RightFaceTraingle22x22, 4, 4)
Me.CellTag(row, column) = "Hide Backup Details Panel"
g.DrawPicture(LeftFaceTraingle22x22, 4, 4)
Me.CellTag(row, column) = "Show Backup Details Panel"
For some reason, the second setting of the CellTag value is reporting an OOBE. There are 1 row and 3 columns defined, and the row and column values at this point are 0 and 2. Anyone have an idea of why this is occurring?
That event will fire for rows that don’t exist. It’s how you can create an iTunes-like UI, for example. Check to make sure the given row < ListCount.
That’s what I suspected, but the list in question is exactly 1 row by 3 columns. Also, the values of row and column are within the bounds of the listbox (0 and 2) at the time of the OOBE. Also, changing the If to:
If row = 0 And column = 2 Then
results in the same OOBE.
This is 19r1.1 on macOS 10.13.6
The number of rows POPULATED (ie. <Listcount) is always <= the number of rows DISPLAYED (which is controled by the listbox.height property)… CellPaint reacts to rows DISPLAYED
and I’ll bet CellPaint is called at least once BEFORE you get a chance to populate anything
As I recommended…
if row < me.ListCount then ...
and Kems suggestion will fix that
That sorted the OOBE, but I’ve now shelved the concept since a group of our beta testers who understand this type of thing gave “two snaps down” on the Hamburger menu idea (which this was part of) and I agree.