How to Set Automatic Scrolling On In a List Box In VB 3.0Last reviewed: June 21, 1995Article ID: Q113329 |
The information in this article applies to:
- Microsoft Visual Basic programming system for Windows, versions 1.0, 2.0, and 3.0
SUMMARYThis article demonstrates two techniques for turning on automatic scrolling inside a Visual Basic list box by using the SendMessage Windows API function. This could be useful with database applications or any type of application in which the user needs to be able to scroll a list box without the use of the arrow keys.
MORE INFORMATIONTwo different techniques are shown below.
Technique OneBehavior: Once automatic scrolling is turned on, any vertical movement of the mouse within the entire horizontal region of the desktop containing the list box will cause the visual selection of an item in the list box. This includes the capability of driving the scroll bar thumb to its upper and lower limits. Drawbacks: With technique one, as long as the automatic scrolling is on, all mouse movement on the desktop is mapped to the list box. Task switching, by using the ALT-ENTER key combination, is disabled. Windows is basically waiting for the completion of a click sequence. Any click anywhere on the desktop will be directed to the Click event of the list box. The user will need to double-click any other control to get the expected response from the control. Double-clicking any other control also turns off the automatic scrolling. NOTE: For those programmers looking for a way to defeat the ability of the user to task switch away from their application, this technique offers a method.
Technique twoBehavior: Once automatic scrolling is turned on, only movement of the mouse within the list box will cause the visual selection of an item. The scroll bar thumb will be driven downward once, but will not be driven back up. Mouse clicks elsewhere on the desktop are processed normally and the automatic scrolling remains on until the mouse is clicked in the list box. Drawbacks: The scroll bar of the list box is not driven in both directions based on mouse movement because mouse movements outside the list box are not processed by the list box.
Example of Setting Automatic scrolling for List box
Additional Steps for Technique One
Additional Steps for Technique Two
|
Additional reference words: 1.00 2.00 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |