05-12-2025 12:05 AM
I want a custom listbox behavior:
The attached code works, but it's ugly and sluggish. How can I make it cleaner and faster?
* In my example, it just beeps.
05-12-2025 01:25 AM - edited 05-12-2025 01:25 AM
05-12-2025 08:59 AM
@GerdW wrote:
Hi Paul,
Why don't you use the DoubleClick item in the Event data?
Gee, I didn't even know about that; and I didn't poke around well enough to find it (D'oh!).
05-12-2025 11:20 AM
05-12-2025 03:05 PM
@altenbach wrote:
There is also a double-click event:
Yes, but it happens after the Value Change event (and I don't want the value to change on a double-click).
05-12-2025 03:40 PM
@GerdW wrote:
Hi Paul,
Why don't you use the DoubleClick item in the Event data?
That gets me slightly cleaner, but no faster. On a double-click, both clicks come through and I have to inhibit the 1st one if there's a 2nd one.
05-12-2025 03:50 PM
@paul_a_cardinale wrote:
@GerdW wrote:
Hi Paul,
Why don't you use the DoubleClick item in the Event data?
That gets me slightly cleaner, but no faster. On a double-click, both clicks come through and I have to inhibit the 1st one if there's a 2nd one.
Using the Mods Double Click and changing your timeout to 100ms seems to work for me without noticeable lag.
05-12-2025 03:59 PM
The DoubleClick item in the Event data does not help you as it is always preceeded by the first click event and you cannot filter that out (at least not without having to recreate the value change behaviour that you do want) without knowing up front that there is a secondary click on its way...
Generally it is a bad idea to modify standard behaviours like this though. People have expectations based on the standards and breaking with those makes the interface non-intuitive. Is what you try to achieve really so unique that it justifies breaking with the standard behaviour? If the intent is to first let the user select multiple items and then e.g. get a view related to all those items when you double click I would either assign that to a separate button below or next to the list, or add a right-click menu item for it instead.
05-12-2025 06:49 PM
@paul_a_cardinale wrote:
I want a custom listbox behavior:
- A single click toggles the selection of an item.
- A double click does something else*, without changing the selection.
The attached code works, but it's ugly and sluggish. How can I make it cleaner and faster?
* In my example, it just beeps.
An alternative (that might need different user instructions) would be to do ctrl+click to toggle an item (that's the default behavior, no code needed) and do an alt-click to do "something else".
05-12-2025 07:56 PM
I hate the default behavior for multiple selection. If you inadvertently let up a little bit on the key, all the selections that you've made so far are cleared.