Spinner

A spinner is a gadget dedicated to entering numbers. It lets you enter them directly as well as increment or decrement the current value with either the mouse or the keyboard. FoxPro 2.x had spinners, but they were really just fancy text boxes. These spinners are much better because they give you tremendous control over what's going on.

Property

Value

Purpose

Increment

Numeric

Determines the amount the value changes with a click of an arrow or pressing an arrow key.

KeyboardHighValue, KeyboardLowValue

Numeric

Determine the highest and lowest numbers that can be entered from the keyboard.

SpecialEffect

Numeric

Determines the appearance of the spinner: 3-D (0); Plain (1), meaning flat; or Hot Tracking (2), meaning flat until the mouse is over it.

SpinnerHighValue, SpinnerLowValue

Numeric

Determine the highest and lowest numbers that can be entered by "spinning."

Text

Character

Contains the spinner value as an unformatted character string.


Event

Purpose

DownClick, UpClick

Occur when the down-arrow or up-arrow is clicked or the keyboard arrows are used.

MouseEnter

Fires when the mouse moves into the area occupied by the spinner.

MouseLeave

Fires when the mouse moves out of the area occupied by the spinner.

RangeLow, RangeHigh

Occur when the spinner tries to lose focus. Each can return a value, and the spinner's value must be between those two values for it to lose focus.


Unlike some other controls, a spinner with SpecialEffect set to Hot Tracking does not take on the 3-D appearance. Since there's no documentation for this, and text boxes and edit boxes behave the same way, we're generously attributing this one to design. It's most noticeable when you move the mouse over the spinner, so it goes 3-D, then click into it, then move the mouse away so you can see what you're typing.


Check out Increment for an example of a spinner whose increment changes as the value changes.

Example

* Set up a spinner class that counts
* by 100's between 1000 and 20000
* and annoyingly beeps when you use the spinner arrows.
oForm = CREATEOBJECT("Form")
oForm.AddObject("spnBigSpin", "BigSpinner")
oForm.spnBigSpin.Visible = .T.
oForm.Show()
 
DEFINE CLASS BigSpinner AS Spinner
 
   Value = 1000
   Increment = 100
   KeyboardLowValue = 1000 
   SpinnerLowValue = 1000
   KeyboardHighValue = 20000
   SpinnerHighValue = 20000
 
   PROCEDURE DownClick
   ?? CHR(7)
   ENDPROC
 
   PROCEDURE UpClick
   ?? CHR(7)
   ENDPROC
ENDDEFINE

See Also

DownClick, Increment, KeyboardHighValue, KeyboardLowValue, MouseEnter, MouseLeave, RangeHigh, RangeLow, SpecialEffect, SpinnerHighValue, SpinnerLowValue, Text, UpClick


Back to Table of Contents

Copyright © 2002-2018 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. Click for license .