Object / Element / Area / Border / Widget / Numeric

The Numeric class is the base class for everything that deals with the input (and display) of integer numbers. The class itself does not feature any UI elements, it just offers some basic attributes and methods. Creating direct instances of this class usually doesn't make any sense. Instead, use one of the included subclasses like the Slider or Gauge classes. to select the type of gadget you need.

The Numeric class and the supplied subclasses communicate with a set of methods. By writing subclasses which override some of them, you can change the behaviour of all sliders to fit your requirements. You could e.g. enhance the builtin value formatting code which is limited to simple printf-style strings by replacing the Stringify method with something more complicated.

If really none of the supplied subclasses of the Numeric class suits your requirements, you may of course write custom classes for numeric data input. If you use the Numeric class, you won't need to think about the basic stuff like min and max values and formatting.

Keyboard control as well as mouse wheel is handled by the Numeric class automatically, subclasses will not have to care about it.

Attributes

Overrides

Implements

Default -- (01.00) [ISG], int32

The Value attribute is set to the value of the Default attribute when the Reset method is invoked.

By default the Default attribute is set to 0.

Format -- (01.00) [ISG], STRPTR

The string format of the Stringify method.

Max -- (01.00) [ISG], int32

Adjust the maximum value of the Value attribute. The maximum value is set to 100 by default.

Min -- (01.00) [ISG], int32

Adjust the minimum value of the Value attribute. The minimum value is set to 0 by default.

Step -- (01.00) [ISG], int32

The value of the Step attribute is used to quickly increase or decrease the Value attribute, when the user is using one of the following customizable keys: FV_KEY_STEPLEFT, FV_KEY_STEPUP, FV_KEY_STEPRIGHT and FV_KET_STEPDOWN.

Value -- (01.00) [ISG], int32

Adjust the current value, which is clipped between the values of the Min and Max attributes.

Whenever a new value is set, the Draw method is invoked to update object display.

The attribute is imported during the LoadPersistentAttributes method and exported during the SavePersistentAttributes method if the "value" keyword is defined in the Persist attribute.

Example

<Slider Value="30" Min="-30" Max="60" Persist="value" />

Decrease -- (01.00)

IFEELIN F_Do(Obj, FM_Numeric_Decrease, int32 Value);

Function

Decrease the Value attribute.

Input

The amount to decrease. If it's negative, the Value attribute is increased.

Result

The new value of the Value attribute.

Increase -- (01.00)

IFEELIN F_Do(Obj, FM_Numeric_Increase, int32 Value);

Function

Increase the Value attribute.

Input

The amount to increase. If it's negative, the Value attribute is decreased.

Result

The new value of the Value attribute.

Reset -- (01.00)

IFEELIN F_Do(Obj, FM_Numeric_Reset);

Function

Set the Value attribute to the value of the Default attribute.

Result

The new value of the Value attribute.

Stringify -- (01.00)

IFEELIN F_Do(Obj, FM_Numeric_Stringify, int32 Value)

Function

Create a string given a value and the Format attribute.

Whenever a subclass of the Numeric class thinks it's time to render a new value, it doesn't simply write it to a string but instead calls the Stringify method, which returns a formated string. In detail, things work like this :

1. Some Slider object receives the Draw method.
2. The Draw method override of the Slider object invoke the Stringify method with the Value attribute.
3. The Stringify method of the Numeric class creates a formated string with the Format attribute and the message's value, and returns the string to the caller.
4. After all this stuff, the Draw method override of the Slider object receives a nice string and finally puts it somewhere into its content box.

All this method stuff might sound a bit crazy, but in fact its quite powerful. If you write a subclass of any of Feelin's slider classes which simply override the Stringify method with your own code, you can create any string you like for display in these sliders. You might e.g. want to display a nice formatted time string (hh:mm:ss) in a slider which adjusts a number of seconds. Or you need to adjust a baudrate from a hand of predefined values. Just overrided the Stringify method and you have the choice how the slider value translates into a string.

Inputs

The value to format as a string.

Development