getText method

  1. @override
void getText(
  1. TStringRef aText,
  2. bool aDisplayText
)
override

Implementation

@override
void getText(TStringRef aText, bool aDisplayText) {
  final buf = TValueBuffer();
  if (_getRaw(buf)) {
    final c = _toDouble(buf.value);
    final fmt =
        (aDisplayText || _editFormat == '') ? _displayFormat : _editFormat;
    if (fmt.isNotEmpty) {
      aText.value = formatFloat(fmt, c);
    } else if (_currency) {
      aText.value = floatToStrF(
          c,
          aDisplayText ? TFloatFormat.ffCurrency : TFloatFormat.ffFixed,
          _precision,
          2 /*digits? (original comment kept as-is)*/);
    } else {
      aText.value = floatToStrF(c, TFloatFormat.ffGeneral, _precision, 0);
    }
  } else {
    aText.value = '';
  }
}