DesktopListbox and Checkboxes

In 2024r1.1 if i have a listbox with checkboxes in column 0 it is impossible to have it select mulitple rows and toggle the checkbox. The selection is cleared and set to the row you are clicking.
I am wanting to add some code to set the checkboxes for all the selected rows to be the same. The mousedown starts the drag to select rows events, before the checkbox fires.

Eg if i check one of the checkboxes, it selects the row.

In theory i could find the rows selected at mouse down, and reset the selection after getting the cellAction event, though this seems a little backwards.

Is there a property or something I’m missing.

You have to do it yourself.
The first thing you should decide is whether the user attempted to check all the checkboxes or just made an ordinary click (the user may just want the behaviour you currently get, to select a single checkbox).

Once you know you want to check every checkbox of the selected rows, you can put this code in the CellPressed event:

for i as Integer=0 to me.LastRowIndex
  if me.RowSelectedAt(i) then me.CellCheckBoxValueAt(i,0)=True
Return True

Next, you might want to determine if your user wants to uncheck all the checkboxes. Don’t get trapped in a custom design; imagine your users may need more than you think.

I personally like the Apple way, e.g. in Music: command-clicking on a checkbox will check/uncheck all checkboxes in a given list. However, I don’t see a direct relation between selected rows and checkboxes; not sure your design is intuitive.

What I have done for years is allow the user the multiple select rows and toggle a checkbox. All selected rows get that checkboxes value. If they check a box outside of the selection only that one is toggled. Works well and allows users to quickly and easily check lots of boxes.

In this new version of xojo the checkbox is not consuming the mouse down event so while the box toggles its state the mouse drag to select rows also occurs, which in turn updates the selection before the cell action is fired.

I have tried consuming the mouse down event myself but have odd results with the checkbox toggling.

I have not tried in cell pressed yet, but the listbox has changed since 2023r4.1 in this area.

If the behavior has changed you may want to create a sample project, write the steps to reproduce and the difference between older version and new version. Please post that to Issues.

1 Like

I also remember very recently a change in how checkboxes are handled inside listboxes. I can’t find the report right now, but it’s possibly related :man_shrugging:t2:

I made a test app in 2023r4 and 2024r1.1 with a Listbox and a desktoplistbox and there is a define change in 2024r1.1 with the desktop listbox. I’ll add to issues

Looks like I could workaround with cell pressed and returning true on the checkbox columns


Listbox selectedChange
Dropbox? rlkey=11n952n4uncfa1uffj31t5p1x&dl=1

Have-you checked the Release Notes ?

2024r1.1 Release Notes

The Dropbox link doesn’t work. Here is the correct link.

It was broken in 2024r1
The changes in 2024r1.1 seem to be related to control being in a popover.

hello Paul,
Thanks for the correction, my 10 year old iMac crashed while sending and I had to go to an appointment and only now noticed the error

Is it just me or can you not attach sample code to new issues?

I have seen a couple of people (in the last few months) saying they can’t upload code. But today I saw several posts from Robin uploading code/images.

Do you get an error?

You can do so with this toolbar item or you should be able to drag-drop into the text area.

Only error i got was PEBCAK. I don’t think i have been in issues for a while and I feel like the interface might of changed.

Managed to edit and attach sample code

I have not been keeping up with recent versions and am using API 1, but that would certainly break a lot of my existing listbox code if I applied it to API 2…

I hope that change is well documented in the release notes as well as the listbox docs … and that it was intentional … If not intensional it would be a bug IMO!

  • Karen

For reference:
#76672 - DesktopListbox cannot toggle a checkbox cell without changing selection

the sample code has 2 listboxes, desktoplistbox left, regular listbox right. Easy to see the difference. Thanks.

It’s not an api 2 issue, it works as I expected on 2023r4, it breaks on 2024r1.
I think this fix broke it

1 Like

Added 2 videos, with 2023r4 and 2024r1.1 to the issue.

1 Like

This behavior would totally break my app and I don’t see it at all. What is the difference between the left and the right listboxes in the example?