JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Setting Up Scroll Bar Arrow Clicks (Small Changes)

As far as the user is concerned, there are three ways to change the setting of a scroll bar: to move the scroll box (also called the thumb), to click the area of the scroll bar between the scroll box and an arrow button, and to click an arrow button. When the user clicks an arrow button, the scroll box moves by an amount stored in the SmallChange property (see also the previous topic, which deals with the LargeChange property).

I know a programmer who thought the SmallChange property was a joke because its name can be interpreted humorously, but it certainly exists. When the user clicks a scroll bar's arrow, the setting of the scroll bar is incremented or decremented (depending on which arrow was clicked) by the value in the SmallChange property. You can set a scroll bar's SmallChange property at design time or at run time.

For example, here I'm setting the SmallChange property for two scroll bars, a horizontal one and a vertical one:

Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    HScrollBar1.Minimum = 0
    HScrollBar1.Maximum = 100
    HScrollBar1.LargeChange = 10
    HScrollBar1.SmallChange = 1
End Sub

Now when the user clicks the arrow buttons, the setting of the scroll bar will change by 1.

Note that on some occasions, you should change the SmallChange property while a program is running. For example, if you let the user scroll through a document with this property, setting it to 1, and the user loads in a 30,000-line document, it might be wise to change the value of this property.

Tip 

This is one of those values that you should test yourself, because it's part of your program's feel. I know of a graphics program that scrolls exactly one pixelat a time when you click the arrow buttons in the scroll bars next to an image. Such a thing is annoying and gives users the impression that your program is unresponsive and hard to use.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor