If I define a listbox and use checkbox in some columen.
I can’t see the checkbox “checked” when I set it checked. because the
CellBackgroundPaint seems override it.
Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) Handles CellBackgroundPaint as Boolean
//don’t khow how to avoid it from this?
//just return false when the cell is “checkbox” would not affected.
End Function
Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) Handles CellBackgroundPaint as Boolean
If row > ListCount-1 Then Return False
Dim type As RowType
type = RowTag(row)
Select Case type
Case RowType.Header
g.ForeColor = &c66CCFF00
g.FillRect(0, 0, g.Width, g.Height)
Return True
Case RowType.Text
Case Rowtype.CheckBox
If column = 1 Then
CellType(row, column) = ListBox.TypeCheckbox
g.ForeColor =&c00000000
g.FillRect(5, 5, 10,10)
return true
End If
I’ve just tried the example. Selected row 2, clicked on the checkbox in row 5.
In my app I have a complex window with one listbox having the first column as checkboxes. Even with custom drawing it’s always been possible to select the checkbox without having to select the row first.
I dont know why your example is ok. but here I am using windows 7,and xojo 2016r4.
default example code is:
If row > ListCount-1 Then Return False
Dim type As RowType
type = RowTag(row)
Select Case type
Case RowType.Header
g.ForeColor = &c66CCFF00
g.FillRect(0, 0, g.Width, g.Height)
Return True
Case RowType.Text
Case Rowtype.CheckBox
If column = 1 Then
CellType(row, column) = ListBox.TypeCheckbox
End If
End Select
and I select row one,and click row 5,
the check state will auto “disapper” ,seems be covered by “write” color.
[quote=303631:@Beatrix Willius]I’ve just tried the example. Selected row 2, clicked on the checkbox in row 5.
In my app I have a complex window with one listbox having the first column as checkboxes. Even with custom drawing it’s always been possible to select the checkbox without having to select the row first.
Your code in CellBackgroundPaint looks okay.[/quote]
I think I have found the reason.
that is you are ok,because your computer is use the windows default theme (or appereance)
and I just cancel of the windows default effect theme and use pure style