The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Using TNumIO2

TNumIO2 has been designed to be a better replacement of TNumIO which causes several intricate problems (regarding event handling and input processsing) due to the fact that it is derived from TCustomEdit. The new TNumIO2 is derived from TCustomControl and mimicks the old TNumIO, but provides additional functionality. However, there are a few differences to TNumIO, mainly concerning the OnChange event and the limitation of the numeric input range (properties RangeLow and RangeHigh).

The application of TNumIO2 is straightforward. Put an instance of the component on a form, set up its properties and events and use it. The numeric format (integer, floating point, fixed point, exponential, binary, octal, hexadecimal) accepted by the component can be selected using the InputFormat property. Setting it to itDynamic leaves the choice of the numeric format to the user.

The properties RangeLow and RangeHigh allow to monitor the range of valid numbers. If the user enters a number below or above this range the input box changes its color (properties ColorWarnText and ColorWarnBG). Whenever the input text is changed by the user the component triggers the OnChange event.

The entered number can be accessed both as a string (property Text) or as a number (readonly property Value). If you try to assign an invalid string to the property the Text the string is discarded and the input field does not change.

You may also display an up/down button at the right side of the numeric input field by setting the property ButVisible to TRUE. The button can be used to increment or decrement the current value by a predefined value (see property ButIncrem).

Further TNumIO2 offers a possibility to input an approximate value by clicking the gauge bar at the proper position. The gauge bar can be made visible by setting the property GaugeVisible to TRUE. The colors of the gauge bar are controlled by the propertoes GaugeColor, GaugeColorBg, and GaugeColorFrame. The size and the position of the gauge bar can be controlled by the properties GaugeHeight, GaugeWidth, GaugeLeftMargin, and GaugeTopMargin.

Finally, the TNumIO2 component provides an additional optional "freeze" checkbox which allows the user to temporarily freeze the input field. This checkbox can be used, for example, to prevent accidental changes of the numeric parameter, or to provide an option to select a system-generated value instead of specifying a particular numeric value. By default, the freeze box is invisible, you can make it visible by setting the property FreezeBoxVisible to TRUE. The location and size of the box can be set by the properties FreezeBoxLeft, FreezeBoxSize and FreezeBoxTop.


Last Update: 2023-Feb-15