Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

Spinner Class Reference

Inherits Control.

List of all members.

Detailed Description

A spinner is an editor with a up/down button to the right of it and optionally a caption to the left.

The up/down button can be clicked or pressed and swung to change the number in the edit box; the control in total is intended to be similar to 3DS Max's ubiquitous spinners.

For example, the following code creates a spinner labeled "Length:" that allows controlling a number from 0 to 100 with 0.1 steps (that is to say, pressing the up/down button or swinging on it results in these steps per press and pixel respectively):

with (new Spinner (this))
    grid (0, 0); // Place the spinner in grid-fitting.
    caption ("Length:"); // Set the caption displayed on the left.
    range (0, 100, 0.1); // Set the range and steps.

The primary dispatcher is the onChange message which is sent when the buttons change the number or when the user inputs a valid number in the edit box. An out-of-range number there is clamped.

Public Member Functions

 this (Control parent)
 Assign the parent, create the spinner and set it up.

void caption (char[] text)
 Set the caption displayed on the left of the spinner.

void range (float lower, float upper, float step)
 Set the lower and upper bounds of the value and the step to use for the spin box.

float rangeStep ()
 Get the step parameter.

void value (float value)
 Set the current value.

float value ()
 Get the current value.

void valueBound (float value)
 Set the value after bounding it, and send a onChange message.

void enabled (bit value)
 Set whether this is active (true) or grayed and inactive (false).

void create ()
 Create the sub-items of the control.

Static Public Member Functions

 this ()
 Setup the GUI class for windows.

Public Attributes

ChangeDispatcher onChange
 Dispatched when the edit box has been modified or when the spin box has been clicked or swung upon.

Protected Member Functions

void digPlatformEditorChanged ()
 Notify onChange if possible.

void digPlatformChildMoved (Control control)

Protected Attributes

EditText digPlatformEditor
 Link to the edit box part of the spinner.

char[] digPlatformCaption
 The caption to put on the left.

Label digPlatformLabel
 Link to the caption object or null if none is used.

SpinnerBox digPlatformSpinnerBox
 Link to the up and down arrows.

float digPlatformLower
 The lower bound of values.

float digPlatformUpper
 The upper bound of values.

float digPlatformStep
 Individual steps for the up and down arrows.

float digPlatformCurrent
 The currently assigned value.

bit digPlatformIgnore = false
 Whether to avoid calling the onChange dispatcher for now.

Static Protected Attributes

WNDCLASS digPlatformWindowClass
 The window class used by spinners.

Member Function Documentation

void Spinner.value float  value  ) 

Set the current value.

This is not affected by range, so out-of-bounds values will be silently accepted. It does not produce an onChange message.

Member Data Documentation

ChangeDispatcher Spinner.onChange

Dispatched when the edit box has been modified or when the spin box has been clicked or swung upon.

Events take (Spinner spinner, float value) or (float value) arguments.

The documentation for this class was generated from the following file:
Generated on Thu Sep 4 13:12:53 2003 for dig by doxygen 1.3.2