Want more information ?. Try the Web Home Page for this document.

PSPNum Value

Given the size of a PSPNum, the real decimal numeric value can be extracted and assigned as a string as follows:

// Extract value to string
String Num1Value1 = Num1.getValue();
// toString() is same as getValue()
String Num1Value2 = Num1.toString();
// Set value from string
Num1.setValue("-123.45");

In the string returned from getValue():

In the string parameter to setValue() and other PSPNum functions taking string numbers:

Value versus Text

The Value property is internal i.e. no-one ever sees it unless you extract it using getValue(). What you see in the edit box is the Text property. Unlike the unformatted Value property, the Text property is formatted according to what you specify for the PSPNum mask. So the Value property is generally the one to use for import/export of the PSPNum value. The Text property is export only.

Value is one of the persistent PSPNum properties. This means that any numeric value you set can be saved for when an application using the PSPNum restarts.

You change the value of the Text property (and the underlying Value) by simply keying into the edit box. Apart from this, you can never change the value of the Text property directly. For example:

// Extract unformatted Value to string
String Num1Value = Num1.getValue();
// Extract formatted Text to another string
String Num1Text = Num1.getText();
// Set unformatted value from string
Num1.setValue("-123.45");
// Can NOT set Text directly (operation ignored)
Num1.setText("US$123.45CR"); // IGNORED !

 

Text Refresh

You can stop the Text property being refreshed from the Value property using the setTextRefresh() function. You may find this useful in cases such as:

// Stop Text being refreshed
Num1.setTextRefresh(false);
// Do intermediate calculations (invisible
// to user because Text does not change)
Num1.add(Num2);
Num1.add(Num3);
Num1.add(Num4);
// Now show final result to user
Num1.setTextRefresh(true);