Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Increment

This property applies to spinners and determines how much the spinner changes each time you click one of the arrows.

Usage

spnSpinner.Increment = nValue
nValue = spnSpinner.Increment

Increment can be either positive or negative. With a negative increment, clicking the up arrow (or pressing the up arrow key) decreases the displayed number, while clicking the down arrow increases it. Weird, but we guess you might want to do it when dealing with dates or times where up could mean further back in time and down could mean more recent.

Increment can be changed while a form is active. For example, you might relate the increment to the magnitude of the spinner value. For instance, increment by 2 until you reach 100, then go by 5 until 200, then by 10. Like the other spinner properties, you can’t set the property itself to change dynamically, but you can change the property programmatically while the form is running. The example shows the code.

Example

* Update spinner increment to be based on the spinner value
* The following code goes in the spinner's InteractiveChange
* method, so the increment is checked each time the spinner
* value changes.
DO CASE
CASE This.Value < 100
   This.Increment = 2
CASE This.Value < 200
   This.Increment = 5
OTHERWISE
   This.Increment = 10
ENDCASE

If the program changes the spinner value in code, too, you’d need to do the same thing in the spinner’s ProgrammaticChange method.

See Also

KeyboardHighValue, KeyboardLowValue, SpinnerHighValue, SpinnerLowValue