What could cause a ListBox in a desktop app to not fire its CellClick or Change events when clicked on?
I’m trying to track down an obscure bug in my desktop app where a couple of macOS users (out of an install base of many thousands) are reporting that clicks on three essential navigation controls are not working. The three controls are all subclasses of ListBox.
I ended up adding extra logging in the ListBox.CellClick and ListBox.Change event handlers of all three controls and they’re not being fired when clicked on. Using the arrow keys does trigger the ListBox.Change event for them.
One of the ListBox instances does not have a ListBox.MouseDown event handler, so I don’t think that this can be caused by returning True from ListBox.MouseDown. The other two instances do have ListBox.MouseDown handlers and they are firing, so I’m going to add extra logging to them to work out if any of the circumstances that cause it them return True could be firing.
A few versions of macOS ago, and a few versions of Xojo ago, there was a bug where if you attempted to drag from within a listbox, and your code attempted to add multiple drag images to the DragItem, it would crash, silently, which was really weird as it just sort of did nothing.
This was hard to debug as it only happened:
with more than one row selected
when dragging (but not clicking, unless the click moved more than a few pixels, in which case it was actually a drag event).
That’s an odd one Mike, but I don’t think it explains what’s happening here with Xojo 2022.1. What’s really puzzling me is that it’s only affecting a couple of users, one using macOS 12, the other using macOS 10.15.
Yes, both have the Wacom tablet drivers installed, but the bug occurs when using an Apple trackpad too. And I’m not sure how the Wacom drivers would prevent clicks registering on the affected ListBox controls while other ListBox controls in the app are fine
Yeah, that would be the next step, is the Listbox receiving mouse down events, and are they where you would expect them to be…
If the listbox receives the mouseDown event, but the co-ordinates are wrong, then this might be the same issue that prevents listboxes from working correctly on a NSPopover. In which case I can provide a hacky solution for handling mouse down at least.
And I am now seeing it on 1 of 4 listboxes present on a main window’s panel. All four had the same events defined, but the problem listbox never fires the CellClick event on Windows - it works on Linux and macOS. My code is never touched:
If Not IsContextualClick Then
Select Case Me.RowTag(row)
Return True // fake header row, so ignore
Return False // let the listbox highlight the row
Catch NilObjectException // never occurs
Return True // ignore the exception
Return False // let the ContextualClick handler do its thing
The same code works on the other 3 listboxes and in this listbox on macOS and Linux.
I haven’t had any users report listbox click issues when built with 2021, but Lightwright uses listbox clicks in probably 200 places, so the odds of it happening somewhere when built with 2022 R1.1 are scary.
I’m already logging a lot of listbox click events, but it’s the absence of those events that needs catching, not sure how to detect when there’s a problem.