in API-2, how do I tell a listbox cell it is a checkbox ?
used to do: listbox-cell = Listbox.TypeCheckbox
can’t find a solution in the documentation
thanks
in API-2, how do I tell a listbox cell it is a checkbox ?
used to do: listbox-cell = Listbox.TypeCheckbox
can’t find a solution in the documentation
thanks
Function CellTextPaint(g As Graphics, row As Integer, column As Integer, x as Integer, y as Integer) Handles CellTextPaint as Boolean
me.CellTypeAt(row,1) = Listbox.CellTypes.CheckBox
End Function
danke Horst, alles ok
I just want to add a “no, no”. Don’t ever modify a Control in it’s Paint-Event(s)!
We’ve seen many examples of “sluggish apps” and “(false) bug reports” because of that.
Why? Changing Properties/Settings of a Control may/will cause it to be repainted (*). This might lead to an endless-repainting-loop.
Please do set up your Listbox outside of it’s Paint-Event(s).
If there should be a Checkbox in all rows in a certain column: ListBox.ColumnTypeAt
So before you’re going to add rows: MyListbox.ColumnTypeAt(checkboxColumnIndex) = ListBox.CellTypes.CheckBox
Or if just some Cells should have a Checkbox, do it when adding that row and cell: MyListbox.CellTypeAt(currentRow,checkboxColumnIndex) = Listbox.CellTypes.CheckBox
i You might want to blame the Xojo Framework for not being always smart and not invalidating the Control if the property/value you’ve assigned already had that value. Workaround would be: if (Control.Value <> xyz) then Control.Value = xyz
. But then think again: Is “while being painted” really the right place to set/change that?[/i]
thanks for the tip, I hope Horst has learned something …