NI Home
Cart Cart | Help
Company Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI

LabWindows/CVI Tip: Using the Mouse Wheel to Scroll Textboxes

VERSION 2 Published

Created on: Mar 14, 2008 2:54 PM by Wendy L - Last Modified:  Mar 14, 2008 3:04 PM by Wendy L

When using textboxes in the user interface, I think that most users automatically think that the mouse wheel can be used to scroll this textbox up and down (so would I). So I wrote a piece of code that I now include in all my projects to support this request. It's actually quite simple. For each panel that gets loaded, I use the InstallWinMsgCallback function, with the MessageNumber parameter set to WM_MOUSEWHEEL.

Important note: for WM_MOUSWHEEL to be defined, windows.h should be included, and _WIN32_WINNT should be at least defined to 0x0400. To make sure this last definition is made, open the Build Options window (can be found in the Options menu), and enter /D_WIN32_WINNT=0x0400 in the "Compiler Defines" field.

I attached an example program to this message, which shows how to enable textbox scrolling with the mouse wheel in a very simple way. More information on the WM_MOUSEWHEEL message number can be found in the MSDN library:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputmessages/wm_mousewheel.asp

I hope this post is usefull for at least some of you guys http://forums.ni.com/i/smilies/16x16_smiley-wink.gif

MouseWheel.zip (4 kb)


Posted by Wim S

Original forum post: http://forums.ni.com/ni/board/message?board.id=180&message.id=28367#M28367



A few accelerators are present in the IDE that can help a lot in developing applications.

Everybody knows that in the UIR editor right-clicking on a control popups a menu by which it's possible to jump directly to control's callback (item "View control callback").

The symmetric action from a source code window is to place the cursor on a control name and press Ctrl-F: you will jump into the UIR editor window with the stated control already selected. This option is equivalent to right-clicking on the control name and select "Find UI object" option).

I recently discovered that this option is present on callback function names too: selecting the function name and pressing Ctrl-F jumps me to the UIR editor window http://forums.ni.com/i/smilies/16x16_smiley-happy.gif If the function is associated to more controls, a popup window will be shown with the list of controls for we to select the desired control to select.

Posted by Roberto Bozzolo


CATEGORIES:
Product Category: LabWindows/CVI
Industry: ATE/Instrumentation
Development Topic: Building a User Interface
Average User Rating
(1 rating)




There are no comments on this document