It's my first TMS Web application, so please bear with me.
I'm testing to display another page after a user login. Here is my code:
procedure TForm1.WebLoginPanel1Login(Sender: TObject);
var
newform: TForm2;
begin
newform := TForm2.Create(Self);
newform.Parent := Form1;
// load file HTML template + controls
await(TForm2, newform.Load());
// init control after loading
newform.WebEdit1.Text := 'hello';
try
// excute form and wait for close
await(TModalResult, newform.Execute);
ShowMessage('Form 2 closed with new value:"' + newform.WebEdit1.Text + '"');
finally
newform.Free;
end;
Form2 has it's align property set to allclient.
Close button code is basic;
procedure TForm2.WebButton1Click(Sender: TObject);
begin
close;
end;
Form1 is displaying after closing the dialogbox.
As soon as I click on the Form1, I'm getting an error:
All TMS Libraries are up to date (Web Core v2.0.2.2).
Only difference I see is setting newform.Parent := Form1;
I have uploaded my project.
Ps: is there any raison why project isn't always displayed on Google Chrome? I have sometime to run project 10x time to get it display
You should not set the parent before the form is loaded. It would already internally create a form instance while in the next step you do form.load() that also creates a form instance.
We are not aware of an issue that it is not displaying in Chrome. Always check your browser console for possible errors and/or ensure your browser cache is cleared (via Empty cache & hard reload option).
I wan't aware that setting parent before loading the form could crash everything (and I couldn't find warning regarding this in the help documentation). Can this not be handled by the framework differently? (it's odd that setting a parent property leads to application crash), anyway I know now why it happened).
Regarding Chrome issue: I tried to clear cache but problem persisted. Everything went fine after Web core 2.0.2.2 installation and VM restart.