[Lazarus] Exception dialog

Graeme Geldenhuys graemeg.lists at gmail.com
Tue Mar 17 15:15:23 CET 2009


Please note, I don't use db-aware components, but here follows the
help from Kylix 3.

On Tue, Mar 17, 2009 at 3:46 PM, Martin Friebe <lazarus at mfriebe.de> wrote:
>
> I have to admit, I have limited knowledge of the exact details of the
> data-aware components, and rather was making a general case about my
> perception of proper exception use.
> I just googled  => can you point me to some documentation on it?
>
> Following you description, I have no problem if an OnValidate allows the
> code to use an exception to signal the component some-error state.
> IMHO the component should have a well defined behaviour on getting this
> exception.


==========[ Kylix 3 help ]================
OnValidate event (TField)
-------------------------
Occurs just before the data is written to the record buffer.


Delphi syntax:
property OnValidate: TFieldNotifyEvent;


C++ syntax:
__property TFieldNotifyEvent OnValidate = {read=FOnValidate, write=FOnValidate};


Description

Write an OnValidate event handler to validate changes made to the data
in the field, just before the data is written to the current record
buffer. The EditMask property allows validation of the data on a
character by character basis while it is being entered by the user.
OnValidate allows an application to validate the data as a whole.

When the value of a field component is assigned programmatically,
validation by the EditMask is bypassed, since there is no data-aware
control to enforce adherence to the mask. OnValidate allows an
application to validate such data before it is posted to the database
table.

To reject the current value of the field from the OnValidate event
handler, raise an exception.

When writing the value of a field to the current record buffer, the
following steps occur:
1. The OnValidate event handler is called to validate the data.
2. If the OnValidate event handler does not raise an exception, the
data is written to the current record buffer.
3. If writing the data does not raise an exception, the OnChange event
handler is called to allow a response to the change.
==========================


Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/




More information about the Lazarus mailing list