getText method

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

Implementation

@override
void getText(TStringRef aText, bool aDisplayText) {
  aText.value = '';
  final buf = TValueBuffer();
  if (!getData(buf)) return;
  final e = _toDouble(buf.value);
  final fmt =
      (aDisplayText || _editFormat.isEmpty) ? _displayFormat : _editFormat;

  var digits = 0;
  TFloatFormat ff;
  if (!_currency) {
    ff = TFloatFormat.ffGeneral;
  } else {
    digits = currencyDecimals;
    ff = aDisplayText ? TFloatFormat.ffCurrency : TFloatFormat.ffFixed;
  }

  if (fmt.isNotEmpty) {
    aText.value = formatFloat(fmt, e);
  } else {
    aText.value = floatToStrF(e, ff, _precision, digits);
  }
}