Example Code

'Done Scrolling' Event for front panel controls in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

 Overview

Demonstrates a work-around to generate a "done scrolling" event even when the mouse drifts off the scroll bar.

 

Description

This example was made in response to a gap in the LabVIEW and Windows event feature set. When using a typical scrollbar, as long as you keep the left mouse button depressed, you keep control of the scrollbar; even if the mouse pointer drifts off of the scrollbar control. You may not even realize this until you think about it, or test your web browser, but it is fairly common for a user to start a scroll, then end up with their mouse on the other side of the screen.

 

This prevents an issue if you are interested in knowing when a user has finished a scroll event. There is no such thing as a "Done Scrolling" event. The "Mouse Up" event hardly helps, as it is not fired if the mouse drifts off of the scrollbar, which it commonly does. Check some of these links for users with the same frustrations:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Create-a-quot-User-Control-Ended-quot-Event/idi-p/1075...

http://forums.ni.com/ni/board/message?board.id=170&view=by_date_ascending&message.id=458604#M458604

http://forums.ni.com/ni/board/message?board.id=170&message.id=480721&requireLogin=False

 

The "Mouse Down" event should be a good indicator that the user has started a scroll. We can take advantage of the Input Device Control Palette in LabVIEW to read the status of the mouse once a scroll has started to poll for when the mouse button is released.

 

Requirements

LabVIEW 2012 (or compatible)

 

Steps to Implement or Execute Code

  1. Run the VI
  2. Use the scroll bar to scroll through the Array of Numbers

 

Additional Information or References

Front panel of the VI

scrollbarevent.png

 

In my testing, this did not work for a scroll wheel.  would be interested in thoughts on how that would work.

 

Enjoy...

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

---

Peter Flores
Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.