I have a TBaseFrame that is derived from a TWebFrame. Next I have a TSpecialFrame derived from this TBaseFrame. When the project is run and the project source code calls Application.CreateForm (TSpecialFrame, FSpecialFrame) apparently an exception is raised which causes the next statements in the project source code to remain un-executed.
While debugging I found out the exception is raised in a call to ValidateRename somewhere in the creation of the new form (which actually is a Frame). The old name is something like preview and the new name Form1. But non of my forms and frames have this name.
Questions: am I not allowed to create a TWebFrame descendant in the project source code? If I am allowed to do so, what could be wrong?
It goes wrong when the statement Name := Form1; is executed. So I think it is a bug in TMS Webcore. Please resolve!
It goes wrong when the second Frame derived from TBasisFrame is created in the project source code.
I must make these frames during startup because otherwise I cannot access the DOM properties after creation of the Frame. Apparently the DOM is updated asynchronously.
procedure TFramePreviewForm.LoadDFMValues;
begin
inherited LoadDFMValues;
FFrame.SetParentComponent(Self);
FFrame.LoadFromForm;
FFrame.BeforeLoadDFMValues;
try
FFrame.Name := 'Frame1';
FFrame.Left := 0;
FFrame.Top := 0;
FFrame.Width := 640;
FFrame.Height := 480;
finally
FFrame.AfterLoadDFMValues;
end;
Name := 'Form1';
Left := 0;
Top := 0;
Width := 640;
Height := 480;
end;
Can you isolate and send a test project with which we can reproduce as the exact setup of what you do is unclear.
Did you receive the example I send by separate mail where I showed this exception? The code is also present in the example code of the OnCreate issue which you just solved.
Create two frames of different type and instantiate them in the .dpr file by calling application.createform(TFrame, Frame) Instantiating the second Frame leads to an exception.
Best
peter
I have not received it.
Note that emails with attachments that contain files considered dangerous (like JavaScript files) might have blocked the delivery of your email.
Try sending it here or via direct message here if this file can’t be publicly shared.
Attached a file that shows the raised exception. Just run it and in project1.dpr an exception is raised when instantiating the second frame.
TMSShowFrameCrash.zip (2.0 MB)
You do not see the error. You can do two things:
- Set a breakpoint in the dpr at the second frame instantiation. Step into and you will see that an exception is raised.
- Create an extra frame3 and instantiate it in the dpr. You will see that this call to application.createform is never executed because the second call to CreateForm crashed.
I will give more details and examples tomorrow.
Here another zip file.
Push the button, and you will see that Frame3 is not instantiated because the creation of Frame2 led to an exception. You can also set a breakpoint on the exception handler in Project1.dpr.
TMSShowBug2.zip (2.2 MB)
We could reproduce this now and we have applied a fix. The next release will address this.
