Quick, potentially embarrassing question.
I vaguely remember a time when you could put a checkbox in a listbox, but for the life of me, I can’t remember how to do it. I looked in the documents under listbox and don’t seem to see it. I’m using Xojo 2020r3. (Yes I know it is old, but didn’t have money to upgrade …)
This should do the trick:
Listbox.ColumnTypeAt = Listbox.CellTypes.Checkbox
(blue is a link to the documentation which will have more info for you)
I knew it was something “simple”. I just forgot how to do it. When I looked through my docs (online for 2020 version), it didn’t jump out at me. Now that you mention it, the light has gone on.
I’m hoping to put enough money together to update my Xojo. Hopefully next payday!
Ok proving once more my brain is slowly dying, I’ve been trying to create a checkbox in a listbox with no success.
When my app opens, the event under app has
askManagerWindow.tasklist.CellTypeAt(0,2) = TaskManagerWindow.TaskList.CellTypeAt.CheckBox
And even when I try using code right out of the documentation (to test) I get the error
App.Open, line 2
There is more than one method with this name but this does not match any of the available signatures.
TaskManagerWindow.tasklist.CellTypeAt(0,2) = TaskManagerWindow.TaskList.CellTypeAt.CheckBox
What in the name of the Incarnations am I doing wrong?
Ok… update… found my issue.
This is what I should have done…
taskManagerWindow.tasklist.CellTypeAt(0,2) = Listbox.CellTypes.CheckBox
Wait 5 minutes, and I’ll probably have another question… grin…
TaskManagerWindow.tasklist.CellTypeAt(0,2) = DesktopListbox.CellTypes.CheckBox
Thanks Ms. Howard.
I’ll change to DesktopListbox, as the documents say that it is the preferred way now.
But one other question, which you seem eminently able to answer. When I do an addrow, how do I get another checkbox to appear? The test I did was a make sure my code was right. But I have tried addrow, rowid, etc. in place of the row “0” in the (0,2) line but get error after error.
Update: Figured it out 2.0. Sometimes, just getting feedback puts you in the right place. So, for any who come after me, here is my solution. Isn’t pretty as others could do but it works, so I’m happy! (Doesn’t take much to make me happy, however…)
TaskManagerWindow.TaskList.CellTypeAt(TaskList.LastRowIndex,2) = Listbox.CellTypes.CheckBox
Would it work for you to simply make the entire column a checkbox with DesktopListBox.ColumnTypeAt? That would save you from having to set each row individually.