Subject Re: DisplayFormat Problem
Author stanw1950
Thanks Marco. Actually, besides 2 decimal positions I use 3 and 4 for
other fields such as for length, width, and density, so I do need
float fields. Using the delphi ttable I only set the displayformat
property for the field. The editformat property used the
displayformat property if no editformat property was set.

I guess the native ibo components don't work that way and I need an
editmask. When the float field is displayed, I want to show (for
example) 4 decimal positions. When the user tabs into the field in
edit mode I want only 4 decimal positions to display, but the user
can type in more. When the user tabs to the next field, I want 4
decimal positions to display again. I can't come up with the proper
editmask That's my problem. I've tried '0.0000' and '#.###' and only
get weird results. I can't find any samples of editmasks. Thanks
again.

Stan Walker


--- In IBObjects@y..., "mmenaz" <mmenaz@l...> wrote:
> Well, I don't know the answer, but you should have clear that the
DIsplayFormat property is the one applied when DISPLAYING, not when
editing. So with it, you will modify only the way that the field is
displayed when you are not in it.
> And, if you use floats, you will have show up the "precision error"
that all floats have, i.e. not all real numbers have a precise
rapresentations in the float type.
> So you enter 11.1112, when you leave the value is stored in the
float field, then is rapresented as 11.109999656, that is what you
get when you enter that field again. There is no solution.
> If you think that 4 decimals are enough, use Currency type, that
are "scaled integers", so you will have precise storage of that value
(of couse, read about INT64 storage in Interbase, i.e. dialect 3 and
numeric with at least, if I remember correct, 10 digits of precision,
but read the manual).
> If you will want to set a limit of the number of decimals the user
can enter (from 1 to 4) and you will use currency type, have a look
at IB_Currency control.
> Hope this will help you a little ;)
> Regards
> Marco Menardi
>
> --- In IBObjects@y..., "stanw1950" <stanw@e...> wrote:
> > Now I notice that the formating doesn't work on the first entry
into
> > the tib_edit in edit mode. Do I need to set the editmask property
> > and, if so, what can I set it to to get a float field to only
display
> > 2 decimal positions when the edit box is tabbed into? Once the
user
> > starts typing, more than 2 decimal positions can be displayed,
but
> > when the user tabs to the next edit box, only 2 should display.
> > Thanks again.
> >
> >
> >
> >
> > --- In IBObjects@y..., "stanw1950" <stanw@e...> wrote:
> > > I have a tib_edit control linked to a float data field from a
> > > tib_query. I have set the DisplayFormat property to 0.00;;#.
The
> > user
> > > is allowed to enter as many decimal positions as he wants, but
only
> > > two position will show. When the query is placed in edit mode
and
> > the
> > > field is tabbed to everything is fine. If the value is 11.11,
that
> > is
> > > what is displayed. If the user changes it to 11.1112 and tabs
out
> > of
> > > the field, then 11.11 is displayed. But when the user tabs
through
> > > all the controls (still in edit mode) and returns to the 11.11
> > field,
> > > 11.109999656 displays (the actual float value). Why did the
> > > formating work the first time through but not after that? I
messed
> > > around with the EditMask format, but that made things worse.
> > >
> > > Thanks in advance. (ibo 4.2.hg; delphi 6 ent)
> > >
> > > Stan Walker