Scrolling the mouse wheel to change values in LabVIEW

Sunday, July 3rd, 2011

This is a simple demo using the mouse wheel to control the numeric indicator in LabVIEW. The value of the ‘mouse wheel position’ increases or decreases when we scroll the mouse wheel forwards or backwards.
The reason of posting this is when I tried to using the mouse wheel to control a camera (to zoom in/out) in LabVIEW, it took me a lot of time finding the right example. If this post happends to be the top 3 of your google results, it should save you some time.
This VI was modified from the example ‘Basic Input’ in LabVIEW. Since the windows’s dll only returns the moved (or related) position of the mouse wheel, a shift register was employed to display the ‘absolute’ position.

Sorry that I cannot upload the .vi file for the limitation of But it is easy enough to re-create this vi yourself from the snippet.
Note that:1. There is no ‘mouse wheel’ triggering event in the event structure (at least before LabVIEW 2009);
2. The .dll file in ‘Acquire input’ returns only the moved position of the mouse wheel comparing to the position when the dll was called last time;
3. The returned mouse wheel postion was divided by 120 in this demo, which may change according to different mouse setups.
4. The polling event (nodes in the while loop) could be put into the timeout case if you want to use event structure together with it (and the timeout shouldn’t be -1).


3 comments on “Scrolling the mouse wheel to change values in LabVIEW

  1. […] functionality (located under the “Connectivity” section).  I found this particular example very […]

  2. Thanks for this example. I just wanted to let you know that I’ve noticed that the “Acquire Input Data” block behaves differently on different systems (even if the OS is the same) – sometimes you get a “differential” value (as I believe you’ve described above), but sometimes it’s “absolute” or a cumulative value of scroll wheel movement. I’ve posted about this in more detail on my site. Thanks!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: