Subject Re: [IBO] Possible Incorrect Logic in TIB_LookupCombo
Author Eric Handbury
--- In IBObjects@y..., Helen Borrie <helebor@t...> wrote:
> At 02:42 AM 04-10-02 +0000, you wrote:
> >Hello,
> >
> > (BCB6-SP2, IBO-4.2Hf, FB-1.0, Enh2.1.2)
> >
> > I have a LookupCombo, which when I hit 'DEL' to delete the
entry in
> >the control, it sets the underlying field to NULL. I don't think
this
> >is correct... I feel it should set the field to the value stored in
> >the DefaultValues.
>
> Defaults are applied to inserted rows only, so they won't kick in
if you
> clear a value in an existing row.
>
> If you don't want Field.Clear behaviour from the DEL key then you
can
> intercept the keystroke and replace it with whatever you want, e.g.
restore
> its original value by referring to the OldValues object (a
TIB_Row); or
> explicitly read the DefaultValues array if you want to access it in
edit
> mode...

But it is logical for IBO to revert the value of the field back to
the value specified in the DefaultValues. Why would IBO set the field
to NULL when I have explicitly told IBO (via the DefaultValues entry)
that I want this field to be 0 as the default?
This characteristic means that if the user inserts and doesn't
select a lookup-entry the field will be stored as a 0 no problems,
but if the user inserts, then selects a lookup-entry, then hits DEL,
a Access Violation is generated. This doesn't make sense and is
inconsistent.