I have a Managed Record named TEmail with a nested private class called TEmailForm that inherits from TForm. The idea is my email Record can create a modal form as needed for the user to type an email. I need the TEmailForm to have a reference to the TEmail Record that created it, so I overloaded the constructor for my nested EmailForm class like this:
constructor Create(AOwner: TComponent; EmailPnt: PEmail); reintroduce;
EmailPnt: PEmail
is a pointer to the TEmail Record that created the form.
I then implemented my constructor like this:
constructor TEmail.EmailForm.Create(AOwner: TComponent; EmailPnt: PEmail);
begin
inherited Create(AOwner);
Email := EmailPnt;
end;
It compiles fine, but when I get to the line that says inherited Create(AOwner);
, I get the following exception:
Project EmailTester.exe raised exception class EResNotFound with message 'Resource TEmail.TEmailForm not found'.
If I move the TEmailForm class outside of the TEmail Record so it is no longer a private nested class, everything works perfectly, but I don’t want the TEmailForm exposed publicly when you use the Unit. What can I do here to get this to work?