Subject Re: [IBO] Still Formatting problems
Author Geoff Worboys
> I have a floating point field.
> I use a TIB_Edit component to display and input data.
> I want the users to see and enter data with maximum two
> digits after the decimal point.
> The display part I can manage using
> IB_Query.Fieldsdisplayformat '#,###,##0.00'
> But when the user tabs into the IB_Edit component the
> display goes from
> 15.45
> to
> 15.4499998092651
> when the user tabs out of the IB_Edit the display goes
> back to
> 15.45
> how do I fix this ?

Rounding issues can get a bit confusing. Possibly the first question
is whether you must use a floating point field or whether you could be
using a NUMERIC(nn,2) field that will store the exact value.

Personnally I use doubles but then I write all sorts of triggers etc
that use UDFs to enforce the storage to round to the required decimal
places. If you can use NUMERIC(x,y) fields then that may be simpler
for you.


> If I have to use a mask, how do I do that, and what
> is the mask ?

Editmasks using TIB_Edit (which uses the standard VCL mask processing)
are really inadequate for the task of editing numeric fields IMHO. If
you want to experiement with what standard masks can do, drop a
TMaskEdit control onto a form and click on the EditMask property for a
dialog that you can experiment with.

TIB_EditEnh provides the ability to implement enhanced mask processing
that provide good support for editing and display of this type of
value.

If you are using IBO3 then TIB_EditEnh comes with IBO. If you are
using IBO4 then you can download my Enhanced Components from
www.telesiscomputing.com.au/enhcomp.htm . You will need to email me
privately for the password to unlock the zip file available at that
site.

If you get the Enhanced edit control drop TEditEnh (the non-ibo-aware
version) onto a form and click on the EditMask property editor
button - this will give you a dialog to experiment with, including
showing you the editmask required to define to IBO.

HTH

Geoff Worboys
Telesis Computing