Two questions (Xojo 2016r4.1, El Capitan) on the code below:
a. Why does it crash on the first
Me.CellTag line ,
b. What is this
Handles Open i the Sub definitiopn Event ?
Sub Open() Handles Open
Dim LocRow As Integer
Me.ColumnCount = 2
LocRow = Me.ListIndex
Me.CellTag(LocRow, 0) = “Dog”
Me.CellTag(LocRow, 1) = “Cat”
BTW: Me.ListIndex is -1 as is nor LocRow (I added to the code just before filling this post).
listindex is the index of the selected row, in your example none so crash
lastindex is The number of the last row added with the AddRow.
And, what about this one:
If Row > -1 And Column > -1 Then
If Me.CellTag(row, column) = "Cat" Then
The crash happens on the second line.
column = 0.
Today had a bad start for me.
I always had troubles with listindex and lastindex, but usually I replace the first with the second. Not today. Definitively a bad day for me.
Definitively a bad day. This (below) does the trick:
If Row > -1 And Row < Me.ListCount - 1 Then
Why don’t you use CellTextPaint instead? It would be much safer, since it is only called for cells that are populated. CellBackgroundPaint is called for all visible cells, whether they have anything in them or not.
Just Because I only want to paint the background, not paint any text ?
just like I will entry pushing the door noted Entry ?
More seriously, if I want to paint a background in Column 1 I can do it.