From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-13-2019 05:51 AM
Hi all,
I need to synchronize the scroll position of 2 listboxes for our project. The "Mouse Wheel" event detects the scrolling when the user wheels the mouse or when the user clicks on up/down arrows in the scrollbar. But this event is NOT detected when the user clicks on a scrollbar and drags it and then leaves it. So in this case the 2 listboxes are not synchronized. Please do suggest if there is any solution to it.
A standalone scrollbar has a "Value Change" event to detect the change even when the user clicks on the bar & drags it. But using this standalone scrollbar is not an option since it does not allow customization (change the color and increase the width for the touchscreen application).
Thanks,
Priyadarsini S
02-13-2019 08:10 AM
If the scroll bar click generates a “mouse down” event, you may be able to something like this:
Mouse down -> determine scroll bar location -> store this value
Mouse up -> determine scroll bar location -> compare to previously stored value
If the values are the same, no action required. If the values have changed, perform action to synchronize the scrollbar of the other listbox.
02-13-2019 09:24 AM
You can try using a .NET scrollbar, if a standalone scrollbar is what you prefer. These seem to be customizable using property nodes. Unfortunately, I can't help you any further than this, in regards to registering for events and such.
Listboxes have a method called Point to Row. Inside the Mouse Down event, use this method to see if the mouse click occurred within the bounds of the listbox content rectangle. If not, the event occurred either on the border of the listbox or in it's scrollbar area. Use this information in a Mouse Move event to update the synchronization. And then stop the synchronization upon mouse up or mouse leave.
02-28-2019 03:46 AM
Hi playerm1,
Yes, that is 1 workaround. But do keep in mind if the user moves the mouse outside the listbox while scrolling & releases the mouse there, then the mouse up event will not be triggered for the listbox. But that can also be worked around by capturing the "mouse up" for the pane. It is still a too much of programming.
Thanks,
Priyadarsini S
02-28-2019 03:51 AM
Hi aputman,
Yes, that is the way to proceed. For now, we are using the LabVIEW listbox native scrollbar itself.
Thanks,
Priyadarsini S