[DUG] Validate data entry
Colin Johnsun
colin.adug at gmail.com
Fri Jun 3 16:17:31 NZST 2011
Hi Wallace,
Don't know if you missed my post or not but if you do your validation on the
OnDataChange event on the TDataSource component, it gets triggered everytime
you modifiy a field value. So if you are in a DBGrid and you change a value
in a column and then move to the next column, the event is fired.
OnValidate happens before posting but OnDataChange occurs whenever a field
is modified of if you scroll to new record.
If you move to a new record you just ignore it by testing the Field
parameter is nil.
Cheers,
Colin
On 2 June 2011 18:00, Marshland Engineering <marshland at marshland.co.nz>wrote:
> >Form inheritance or Frames to cut
> >down on the number of different entry points.
>
> The program is set of sequences for machining. A DBGrid displays the
> operations.
>
> On double clicking the DBGrid operation, opens a form with the relevant
> data and the graphics is displayed.
> The data entry points are placed on the graphic at the point of interest.
> So each entry form is completely different.
>
> The machining steps are
>
> Thread, Rough Turn, Plunge cut, Face etc and all can be internal as well.
>
> However for example - each form has a Depth Of Cut that has a range of 0.02
> -2.5 mm.
>
> My thoughts
>
> -Create a new DB aware component that has a maximum and minimum range and
> use it on each form. Not ideal as I have to ensure consistency between all
> forms.
>
> -If I use OnValidate in the DM, when is this event triggered? On Post ?
> If so then I could have several errors occurring at the same time when the
> data validated, which error belongs to which field ?
>
> If I use OnValidate - when I append a record, will it run all the
> OnValidate procedures at once ?
>
> It looks like I may have to split the operation into to parts - check that
> the data entered is in the correct format (Form Property) and another to
> check it is in the right range (Database Property)
>
> PS Why Delphi didn't have a DBEditNumeric or EditNumeric component I'll
> never know.
>
>
> Thanks Chaps.
>
>
>
>
> _______________________________________________
> NZ Borland Developers Group - Delphi mailing list
> Post: delphi at delphi.org.nz
> Admin: http://delphi.org.nz/mailman/listinfo/delphi
> Unsubscribe: send an email to delphi-request at delphi.org.nz with Subject:
> unsubscribe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserver.123.net.nz/pipermail/delphi/attachments/20110603/fed054f2/attachment.html
More information about the Delphi
mailing list