NumberControl-class

Derived from: public BTextControl

Declared in: Controls.h


Overview

This is a BTextControl that allows only numbers to be entered (and opionally a minus sign). It also has functions with which you can set and retrieve the value as integer. Currently this class does not allow for other than integer values.

Constructor

NumberControl()

  NumberControl(BRect frame, const char* name, const char*
    label, const char* text, BMessage *message,
    int32 maxBytes=5, bool allow_negatives=FALSE)
First disallows all of the characters from the text view by BTextView's DisallowChar. Then allows integers '0'-'9'. After this also allows '-' if allow_negative is true. Then sets the maximum number of bytes for the text-view to be maxBytes.

The rest of the parameters are passed straight to BTextControl constructor.


Member Functions

SetValue()

  void  SetValue(int32 value)
This sets the text-view to display a decimal representation of the value.

Value()

  int32  Value()
Returns the integer representation of the text-view's string.