Multi-select Listbox without Ctrl

Hello,

I’m looking for a way to enable listbox multiple selections without the use of the ctrl/shift keys. In VB and .Net it’s as simple as setting Listbox.SelectionMode to MultiSimple, but no equivalent property exists in Xojo - There’s just Listbox.SelectionType which is only Single/Multiple.

The issue is that I need to allow multiple selections for users on a touchscreen that have no Ctrl/Shift keys.

On your mouse down, go through the list and store which entries are selected. Then after the click is complete, go through the list again re-select the “old” stored entries that you just stored?

keep track of them your self.
set a flag in cellclick… or doubleclick

Thanks guys, I just submitted feedback case #51353 - “I understand this functionality can be replicated in Xojo code, however since touchscreens are now such a ubiquitous part of Windows, and literally every application with a multiple-selection listbox could suffer from this oversight when run on a touchscreen system, I would contend that MultiSimple should be offered as a built-in feature of Xojo.”

While that may be true… don’t hold your breath on new functionality being added to the Listbox in time for you to deploy your application… creating a listbox subclass yourself would be a much faster solution (it might take you a day or two, Xojo might take a year or 3 if ever)

Luckily in my case it was simple after thinking about it for a few minutes.

In the CellClick event I added this code:

if keyboard.AsyncShiftKey=false and keyboard.AsyncControlKey=false then me.selected(row)=not(me.selected(row)) return true else return false end if

1 Like