I am trying to create a generic test routine to determine whether a form meets specified criteria. At the moment I have to list each form that contains a particular variable in order to typecast the form to the correct type to allow the check...
// Check ID match
if Length(FormIDString) = 0 then // Any instance will do
IDMatch := True
if f is TListEditDialog then // For ListEditDialog
IDMatch := (TListEditDialog(f).FormIDString = FormIDString);
if f is TBillForm then // For BillFormDialog
IDMatch := (TBillForm(f).FormIDString = FormIDString);
// other forms here, if the form is not listed the IDMatch default value of false is retained
I need to check whether the variable FormIDString exists in the form (f) that has been passed, and check its value if it does. Can anyone suggest a better way that does not require the code to be modified any time a form is added to the project?