I have a report from a user about one of my MAS apps that has me stumped. There is a single listbox in the main window that accepts multiple selections and handles option-clicks for checkboxes in the CellAction event. The user has sent a screen capture of strange behavior when trying to toggle the checkboxes in the listbox. I have been unable to reproduce this behavior and everything looks normal on test computers. In addition to the weird checkbox behavior, some of the user’s listbox column headings are incorrect.
Here’s the normal listbox behavior on my computer and the others Macs I have tested the app on:
And here’s the movie from the end user of the odd listbox behavior:
Here’s a screen cap of my Main Window of the listbox with correct headings:
And the user’s screen cap of the listbox with incomplete headings:
Here’s the code I have in the ListBox.CellAction event:
Dim selectedRows() As Integer // Will hold the index of each selected row dim checked as Boolean // handle option-click of checkbox if column = 0 then If Keyboard.OptionKey Then for i as integer = 0 to me.LastRowIndex me.CellCheckBoxValueAt(i, 0) = not me.CellCheckBoxValueAt(i, 0) 'toggle all checkbox values next me.CellCheckBoxValueAt(row, column) = not me.CellCheckBoxValueAt(row, column) 'toggle the checkbox value of the clicked row end if end if // // is the media online? if not, don't allow the checkbox to be checked if me.Cell(row, 7) = kListHeadMediaNotFound then me.CellCheck(row, column) = False else // handle multiple row checking and unchecking if me.SelCount > 1 then For i as integer = 0 To ListBox1.ListCount - 1 // Rows are zero-based If ListBox1.Selected(i) Then selectedRows.Append(i) // This row is selected End If Next // is the click on a selected row? for i as integer = 0 to UBound(selectedRows) if row = selectedRows(i) then // is the row checked or unchecked? if me.CellState(row, 0) = Checkbox.CheckedStates.Unchecked then checked = true ElseIf me.CellState(row, 0) = Checkbox.CheckedStates.Checked then checked = false end if // set the checkbox on the selected rows for j as integer = 0 to UBound(selectedRows) if checked = true then me.CellState(selectedRows(j), 0) = Checkbox.CheckedStates.Unchecked elseif checked = false then me.CellState(selectedRows(j), 0) = Checkbox.CheckedStates.Checked end if next end if next end if end if
I have a vague memory of this kind of listbox behavior in a couple of beta builds for another app several years ago, but I haven’t seen it since.
Many thanks for any ideas or suggestions?