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 (getData(buf)) {
    final bcd = _toDouble(buf.value);
    final fmt =
        (aDisplayText || _editFormat == '') ? _displayFormat : _editFormat;
    if (fmt.isNotEmpty) {
      aText.value = formatFloat(fmt, bcd);
    } else if (_currency) {
      aText.value = floatToStrF(
          bcd,
          aDisplayText ? TFloatFormat.ffCurrency : TFloatFormat.ffFixed,
          _precision,
          2);
    } else {
      aText.value =
          floatToStrF(bcd, TFloatFormat.ffGeneral, _precision, size);
    }
  } else {
    aText.value = '';
  }
}