The Layout Library: SpinButton

Derived from: public MView, public MDividable, public BControl

Declared in: <SpinButton.h>


Overview

A SpinButton is a control consisting of a textbox and two buttons, that allows you to enter numeric values by either typing a value into the textbox, and to increase or decrease the value in the textbox by clicking on the buttons.
You can also set the minimum and maximum value the SpinButton will allow, the stepsize to use when increasing/decreasing the value of the SpinButton and the format string with which the value will be displayed.


Constructor and Destructor


SpinButton()

    SpinButton(const char *label,spinmode mode, BHandler *target=NULL)
Creates a SpinButton with the given label, mode and target.

Mode is one of SPIN_FLOAT and SPIN_INTEGER, which will make the SpinButton accepts floating point or integer values respectively.


~SpinButton()

    virtual ~SpinButton()
Destroys the SpinButton.

Member Functions


AllAttached()

    virtual void AllAttached()
Sets the target of the SpinButton to be the target that was specified when the SpinButton was constructed.


Decrement(), Increment()

    double Decrement()
    double Increment()
Decreases/increases the value of the SpinButton by the current stepsize.


Format(), SetFormat()

    const char * Format() const
    void SetFormat(const char *f)
Returns or sets the current format string of the SpinButton's textbox.


Maximum(), Minimum(), SetMaximum(), SetMinimum(),

    double Maximum()
    double Minimum()
    void SetMaximum(double max)
    void SetMinimum(double min)
Returns/sets the current maximum/minimum allowed value of the SpinButton.


MessageReceived()

    virtual void MessageReceived(BMessage *mes)
Processes the messages generated by the textbox and buttons.


SetStepSize(), StepSize()

    void SetStepSize(double step)
    double StepSize()
Sets and returns the current stepsize.


SetValue()

    virtual void SetValue(int32 v)
    virtual void SetValue(double v)
Sets the value of the SpinButton to v


Value()

    double Value()
Returns the current value of the SpinButton as a double.