Board index » delphi » DBGrid Editmask bug or what? Please look at this!

DBGrid Editmask bug or what? Please look at this!

Hi all,

some time back I posted some help for a way to use an editmask in a table.  
I have received multiple responses and more support than I could have wished
for.  Thank you to all those that helped me!!!

With this in mind, I have somehow found something in TDBGrid components and
EditMasks that does not add up.  Please read the following correspondence
and supply me with an explanation if you can.

I must note I don't want to jump to the conclusion of bugs existing in
Delphi as I love the product and hope it is successful.  I am a novice with
Delphi and would like to get some accurate understandings of some of the
components even if it costs me embarrassment such as in this case if I'm
totally in the bleachers with my accusations.

========================================================
Date: Tue, 05 Dec 1995 15:28:08 -0700
From: Bob to protect the innocent from flames
Organization:
To: ME
Subject: Re: Delphi Edit Mask in DBGrid help please!!!!
References: <199512052132.QAA91982@poe.acc.{*word*269}ia.EDU>

Quote
I wrote:
> In a form with a field called SSN with an edit mask of 000\-00\-0000;1;_
the
> mask to me means a number is REQUIRED in all the '0' spots of the mask not
> accepting blanks.  This in fact seems to be the case when I try to leave
the
> field with a value of 123-__-___ where the '_' implies blanks.  Validation
> of the edit mask catches the improperly entered data as it should.

> Now, I'm sure you can see the question here, in a table this is not the
> case.  With the same field name AND mask the picture shows fine and when I
> enter data the dashes appear in the right places.   The problem surfaces
> when I post the record.  It allows me to save the record with a SSN of
> 123-__-____.

After read your message, I tried to connect a DBGrid and a TDBEdit to a
field.
The EditMask worked fine with TDBEdit, but the TDBGrid had the same problem
as
you deiscripted. It seemed to me that the TDBGrid does not work correctly. I
could not find the reason. You may want to post the problem to the news
group.

Quote
> Due to my lack of experience with Delphi I do not know what extra code I
> might need to supply to validate the fields upon exiting them or what I
need
> to do to even validate the fields against the editmask at prepost.  I just
> assumed the editmask in the table would be the same functionally as the
> editmask in a from.  Wrong assumption on my part I guess.

Yes, you are right. EditMask supposes to do exactly what you want. It might
be
a Delphi bug. However, we have to live with it till someone fixes it, or
tells us
how. Meanwhile, if you want to write your own code to do the job, OnChange
event
is one of the places to go.

==============================================================
Thanks in advance for any help you may have to offer!!!!

v...@{*word*269}ia.edu

 

Re:DBGrid Editmask bug or what? Please look at this!


In <DJ65FM....@murdoch.acc.{*word*269}ia.EDU> v...@{*word*269}ia.edu (Carl Viet

Quote
Rees) writes:

>Hi all,

>some time back I posted some help for a way to use an editmask in a
table.  
>I have received multiple responses and more support than I could have
wished
>for.  Thank you to all those that helped me!!!

>With this in mind, I have somehow found something in TDBGrid
components and
>EditMasks that does not add up.  Please read the following
correspondence
>and supply me with an explanation if you can.

>I must note I don't want to jump to the conclusion of bugs existing in
>Delphi as I love the product and hope it is successful.  I am a novice
with
>Delphi and would like to get some accurate understandings of some of
the
>components even if it costs me embarrassment such as in this case if
I'm
>totally in the bleachers with my accusations.

>========================================================
>Date: Tue, 05 Dec 1995 15:28:08 -0700
>From: Bob to protect the innocent from flames
>Organization:
>To: ME
>Subject: Re: Delphi Edit Mask in DBGrid help please!!!!
>References: <199512052132.QAA91...@poe.acc.{*word*269}ia.EDU>

>I wrote:

>> In a form with a field called SSN with an edit mask of
000\-00\-0000;1;_
>the
>> mask to me means a number is REQUIRED in all the '0' spots of the
mask not
>> accepting blanks.  This in fact seems to be the case when I try to
leave
>the
>> field with a value of 123-__-___ where the '_' implies blanks.
Validation
>> of the edit mask catches the improperly entered data as it should.

>> Now, I'm sure you can see the question here, in a table this is not
the
>> case.  With the same field name AND mask the picture shows fine and
when I
>> enter data the dashes appear in the right places.   The problem
surfaces
>> when I post the record.  It allows me to save the record with a SSN
of
>> 123-__-____.

>After read your message, I tried to connect a DBGrid and a TDBEdit to
a
>field.
>The EditMask worked fine with TDBEdit, but the TDBGrid had the same
problem
>as
>you deiscripted. It seemed to me that the TDBGrid does not work
correctly. I
>could not find the reason. You may want to post the problem to the
news
>group.

>> Due to my lack of experience with Delphi I do not know what extra
code I
>> might need to supply to validate the fields upon exiting them or
what I
>need
>> to do to even validate the fields against the editmask at prepost.
I just
>> assumed the editmask in the table would be the same functionally as
the
>> editmask in a from.  Wrong assumption on my part I guess.

>Yes, you are right. EditMask supposes to do exactly what you want. It
might
>be
>a Delphi bug. However, we have to live with it till someone fixes it,
or
>tells us
>how. Meanwhile, if you want to write your own code to do the job,
OnChange
>event
>is one of the places to go.

>==============================================================
>Thanks in advance for any help you may have to offer!!!!

>v...@{*word*269}ia.edu

The above mask will
    a.  require numeric characters in all positions,
    b.  store the dashes in the database.

If you don't want to store the dashes in the database then the second
parameter should be st to 0 instead of 1.  It is not a Delphi bug.
If this is not what your problem is all about please E Mail me.
Ben
Arrow Software

Other Threads