Unfortunately, Return True (do the trick for the Row highlight), but stop processing the TextPaint and BackgrountPaint Events (where I use Return True too)
I already wrote about that, but I add these Events:
CellBackgroundPaint to draw a special background into the Clicked Cell,
CellTextPaint to draw the Text in color (blue) in the Clicked Cell.
Then, I do not want to get the Row selected; so I added:
Event CellClick(row as Integer, column as Integer, x as Integer, y as Integer) As Boolean
Me.EditCell(row, column)
Me.ListIndex = -1 // This must come after the EditCell call
Return True
End
thank you for the tip, but I do not want to edit a Cell, just click in it and change its background and text color (without selecting the whole Row).
Hint:
I just was playing with that Listbox and discovers that a double click do the trick (and I do not have added a DoubleClick Event !)
For simplicity, I also disabled the KeyDown and KeyUp Events.
BTW: in my previous reply, you can see Me.Selected(Row) = False. I added it because the other line doe not produce the result I was awaiting. I also changed the apparition order (of the lines), but it is still reluctant to do what I want.
In short: I searched a bit before asking (but I may skip a line or two here and there).
[code]Property mColumn As Integer = -1
Property mRow As Integer = -1
Event CellClick(row as Integer, column as Integer, x as Integer, y as Integer) As Boolean
mRow = row
mColumn = column
Me.InvalidateCell(row, column)
End
Event CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean
If mRow = row And mColumn = column Then
g.ForeColor = RGB(255, 0, 0)
Else
g.ForeColor = RGB(255, 255, 255)
End
g.FillRect(0, 0, g.Width, g.Height)
Return True
End
Event CellTextPaint(g As Graphics, row As Integer, column As Integer, x as Integer, y as Inte ger) As Boolean
If mRow = row And mColumn = column Then
g.ForeColor = RGB(255, 255, 0)
Else
g.ForeColor = RGB(0, 0, 0)
End
Return False
End[/code]
That is not correct. You need to draw the background with FillRect and return True or the selection will be drawn by Xojo (indepent of the return value).
Event CellClick(row as Integer, column as Integer, x as Integer, y as Integer) As Boolean
Me.EditCell(row, column)
Me.ListIndex = -1 // This must come after the EditCell call
Return True
End[/quote]
In fact, I spend a bit of time commented out a line of code, run, and doing so for the whole event.
Then, following this conversation advice, I add Return True (or False), run and test again.
The above allows me to remove these two lines (useless):
Me.Selected(Row) = False
Me.ListIndex = -1
One more thank you all.
Markus: I nearly not saw your post (it comes while I was writing this one). I do not wanted to edit the Cell so, I skipped the most important line. Sorry.