Subject Re: Fields of type Currency !
Author Marco Menardi
--- In IBObjects@yahoogroups.com, "Antonio Carlos Nunes Junior"
<knowledge@b...> wrote:
> Hi,
>
> I have several tables with fields of type currency, how to do only
> accept unsigned values?
>
> I tried the property Edit Mask in the TIB_Query, but it seems doesn't
> works well with that type of field.
>
> Could someone help me?
>

Well, just a trick.
First, define a constrain in the database for that field to make it
accept only positive numbers. Remember that a good design is one that
makes the database enforce the business roules, so whatever client
will enter data will not be able to instert uncorrect data into the
database.
Second, you can use the native component TIB_Currency. This component
makes a better handling of the monatary values, but still lets you
enter negative ones. To avoid it you can intercept the "-" in the
OnKeyPress (or OnKeyDown?) event and skipt that caracter (key := 0).
(btw, you can use the same code event for ALL your controls that have
to skip the negative sigh).
You could also subclass TIB_Currency and provide your own descendant
component that does it, or modify TIB_Currency code and recompile.
I would also suggest you to read the Whitepaper "RAD with IBO" (in the
collection of white papers that you find on the official IBO site),
and have a look how to set properties globally for certain domains.
Hope this will help
best regards
Marco Menardi