An entryfield with a spinner for entering numeric or date values.

Syntax

[<oRef> =] new SpinBox(<container> [,<name expC>])

<oRef>

A variable or property—typically of <container>—in which to store a reference to the newly created SpinBox object.

<container>

The container—typically a Form object—to which you’re binding the SpinBox object.

<name expC>

An optional name for the SpinBox object. If not specified, the SpinBox class will auto-generate a name for the object.

Properties

The following tables list the properties, events, and methods of interest in the SpinBox class.

Property

Default

Description

baseClassName

SPINBOX

Identifies the object as an instance of the SpinBox class

border

true

Whether the SpinBox object is surrounded by the border specified by borderStyle

className

SPINBOX

Identifies the object as an instance of a custom class. When no custom class exists, defaults to baseClassName

colorHighlight

 

The color of the text in the SpinBox object when the object has focus

colorNormal

WindowText
/Window

The color of the text in the SpinBox object when the object does not have focus

dataLink

 

The Field object that is linked to the SpinBox object

function

 

A text formatting function

picture

 

Formatting template

rangeMax

 

The maximum value

rangeMin

 

The minimum value

rangeRequired

false

Whether the range values are enforced even when no change has been made

selectAll

true

Whether the entryfield contents are initially selected when the SpinBox object gets focus

spinOnly

false

Whether the value may changed using the spinner only or typing is allowed

step

1

The value added or subtracted when using the spinner

validErrorMsg

Invalid input

The message that is displayed when the valid event fails

validRequired

false

Whether to fire the valid event even when no change has been made

value

 

The value currently displayed in the SpinBox object

 

Event

Parameters

Description

key

<char expN>,
<position expN>,
<shift expL>,
<ctrl expL>

When a key is pressed in the entryfield portion of the spinbox. Return value may change or cancel keystroke.

onChange

 

After the spinner is clicked

onKey

<char expN>,
<position expN>,
<shift expL>,
<ctrl expL>

After a key has been pressed (and the key event has fired), but before the next keypress.

valid

 

When attempting to remove focus. Must return true, or focus remains.

 

Method

Parameters

Description

copy( )

 

Copies selected text to the Windows Clipboard

cut( )

 

Cuts selected text to the Windows Clipboard

keyboard( )

<expC>

Simulates typed user input to the SpinBox object

paste( )

 

Copies text from the Windows Clipboard to the current cursor position

undo( )

 

Reverses the effects of the most recent cut( ), copy( ), or paste( ) action

 

The following table lists the common properties, events, and methods of the SpinBox class:

Property

 

Event

 

Method

before
borderStyle

dragEffect

enabled

fontBold

fontItalic

fontName

fontSize

fontStrikeout

fontUnderline

form

height

helpFile

helpId

hWnd

id
left

mousePointer

name

pageno

parent

printable

speedTip

statusMessage

systemTheme

tabStop

top

visible

width

beforeRelease
onClose

onDesignOpen

onDragBegin

onGotFocus

onHelp

onLeftDblClick

onLeftMouseDown

onLeftMouseUp

onLostFocus

onMiddleDblClick

onMiddleMouseDown
onMiddleMouseUp

onMouseMove

onOpen

onRightDblClick

onRightMouseDown

onRightMouseUp

when

drag( )
move( )

release( )

setFocus( )

Description

Use a spinbox to let users enter values by typing them in the textbox or by clicking the spinner arrows.

By setting spinOnly to true, you can control the rate at which users change numeric or date values. For example, one spin box might change an interest rate in increments of hundredths, while another might change a date value in week increments. Set the size of each increment with the step property; for example, if you set step to 5, each click on an arrow changes a numeric value by 5 or a date value by 5 days.

To restrict entries to those within a particular range of values, set the rangeMin property to the minimum value and rangeMax to the maximum value, then set rangeRequired to true.