cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Listbox Behavioe

paul_a_cardinale
Active Participant

Custom Listbox Behavioe

Message contains an attachment

I want a custom listbox behavior:

  1. A single click toggles the selection of an item.
  2. 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.

13 REPLIES 13
Highlighted
GerdW
Knight of NI

Re: Custom Listbox Behavioe

Message contains an image Message contains an attachment

Hi Paul,

 

Why don't you use the DoubleClick item in the Event data?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
paul_a_cardinale
Active Participant

Re: Custom Listbox Behavioe

Message contains an image

@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!).

altenbach
Knight of NI

Re: Custom Listbox Behavioe

Message contains an image

There is also a double-click event:

 

altenbach_0-1747066799189.png

 

paul_a_cardinale
Active Participant

Re: Custom Listbox Behavioe

Message contains an image

@altenbach wrote:

There is also a double-click event:

 

altenbach_0-1747066799189.png

 


Yes, but it happens after the Value Change event (and I don't want the value to change on a double-click).

paul_a_cardinale
Active Participant

Re: Custom Listbox Behavioe

Message contains an image

@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.

mcduff
Trusted Enthusiast

Re: Custom Listbox Behavioe

Message contains an image

@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.

Mads
Active Participant

Re: Custom Listbox Behavioe

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.

altenbach
Knight of NI

Re: Custom Listbox Behavioe


@paul_a_cardinale wrote:

I want a custom listbox behavior:

  1. A single click toggles the selection of an item.
  2. 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".

paul_a_cardinale
Active Participant

Re: Custom Listbox Behavioe

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.