LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

What event, if any, is generated when a listbox scrollbar is moved ?

When using a listbox various events are generated. However, it seems if most mouse related events are applicable to the listbox area and NOT the scrollbar area. Is an event generated when the scrollbar is moved using the mouse ?
0 Kudos
Message 1 of 4
(3,536 Views)
When the scrollbar is selected by the user, an event LEFT_CLICK is generated. Since the user has to keep pressing the left button of the mouse to move the scrollbar around, no other event is generated. Note that while the pointer of the mouse is in the scrollbar area, no changes take effect to the items in the listbox. That is, the user cannot select an item of the listbox while scrolling up or down. For this reason, it doesn't make sense to generate an event when the user is scrolling. Maybe if you explain in more detail why you need to capture this event we can help you better?
To get a list of all the events that are generated on controls go to the UI editor and select the menu "Code >> Preferences >> Default Control Events."

Regards,
Azucena
NI
0 Kudos
Message 2 of 4
(3,536 Views)
You don't get a specific event when the user changes the scrolling position of a listbox. It's not really considered a value change, or a commit.

If you need to know when the user scrolls a listbox, you need to create a timer control and then check the vertical scroll offset of the listbox at regular intervals. If you do that, you'll detect changes even before the user releases the mouse. If that doesn't work for you, then you'll have to use the toolbox's extended event functions instead, which will allow you to catch a mouse up event.

Luis Gomes
NI
0 Kudos
Message 3 of 4
(3,536 Views)
Just wanted to add here that if you are ever curious as to what events are being generated upon user action, you can go to the .uir file, and change your cursor to the hand and finger. This simulates the user "clicking around" on your panel. You'll notice that as you click, in the upper right corner, the events that take place are listed out as they occur. You have to look fast, as sometimes several can happen in a row, and they switch quickly. There is an EVENT_LEFT_CLICK for sure, and depending on what control has focus, there can also be a EVENT_GOT_FOCUS and an EVENT_LOST_FOCUS. How about that? A question that was answered by three NI employees in three different departments. Cool, huh?
0 Kudos
Message 4 of 4
(3,536 Views)