Form inheritance and overriding functions.
Posted on 2001-08-10
I have a form which is used as a template (via inheritance) to create "real" forms (via New ... and choosing my template form).
(Don't know the right terminology, so please excuse me!).
The form contains a whole load of controls with some basic events behind them.
One of the events needs to call a validation routine.
This routine is different for each of the real forms.
frmMaint is the template form.
frmMaintUsers is one of the new forms, based on frmMaint, frmMaintJobs is another.
The frmMaint form has an event on the OK button to determine if the values can be saved.
I would like to be able to have in the OK event something like ...
if (ValidateForm) then ...
Where ValidateForm can be different for each of the new forms as the actual things to be validated are different.
In the new forms, I am expecting something like ...
function TfrmMaintUsers.ValidateForm : Boolean;
// Do my validation now.
Result := whatever;
I do not know how to declare this function in the template form nor in the new form so that it is inherited properly.