Board index » delphi » Questions about data-aware controls

Questions about data-aware controls

Hi,  I'm writing an app with Delphi 1.0 and still have lots of questions
about data aware components.

Someone here told me about associating a Maskedit to a data-aware
component to do validation.  The question I have is what do you
do if you enter a field and decide to leave it blank?  The mask
generates an error message.  How do you trap that error and ignore it to
allow a blank field?

Another question.  I have a form that uses a lot of data-aware
components tied to one table.  When the table activated all the fields
fill up with the top record of the table.  I want them to be blank until
the user enters the correct key, or if the key is incorrect allow the
user to append a new record.  Having a default record show up confuses
the users.  Any ideas on this? (besides not using data-aware
components).

Thanks,

Dan

 

Re:Questions about data-aware controls


Quote
Dan Axtell <d...@nai.net> wrote:
> Hi,  I'm writing an app with Delphi 1.0 and still have lots of questions
> about data aware components.

> Someone here told me about associating a Maskedit to a data-aware
> component to do validation.  The question I have is what do you
> do if you enter a field and decide to leave it blank?  The mask
> generates an error message.  How do you trap that error and ignore it to
> allow a blank field?

I believe you can always ESCape or TAB before entering something. If
you want to trap the error and ignore it, why apply a mask at all? To
allow a blank field, check your mask on REQUIRED format characters,
because that's probably what causes your problem.

Quote
> Another question.  I have a form that uses a lot of data-aware
> components tied to one table.  When the table activated all the fields
> fill up with the top record of the table.  I want them to be blank until
> the user enters the correct key, or if the key is incorrect allow the
> user to append a new record.  Having a default record show up confuses
> the users.  Any ideas on this? (besides not using data-aware
> components).

Basically, what you want is apply a range or a filter before your
dataset is opened, so you have to get the parameters from somewhere
else than that dataset. Common practice is to use a simple editbox for
setting query parameters...

Happy programming!

Jasper

PS: please take into consideration
- when replying, I just think I know;
- when asking, be sure that I don't.

Re:Questions about data-aware controls


Quote
Dan Axtell (d...@nai.net) wrote:

[snip]
: Another question.  I have a form that uses a lot of data-aware
: components tied to one table.  When the table activated all the fields
: fill up with the top record of the table.  I want them to be blank until
: the user enters the correct key, or if the key is incorrect allow the
: user to append a new record.  Having a default record show up confuses
: the users.  Any ideas on this? (besides not using data-aware
: components).

Hello Dan,

what about  datasource.dataset := nil; at beginning and then
datasource.dataset := table;

datasource.enabled := false / true   may also work.

then add simple TEdit to get user key. make it invisible during normal
edit or insert if needed.

Tanel

Other Threads