Hello,
Sometime ago I asked about creating forms asynchronously, whereupon Bruno gave me the following code.
var
newform: TForm2;
begin
newform := TForm2.Create(WebPanel1.ElementID);
TAwait.ExecP<TForm2>(newform.Load());
// init control after loading
newform.frm2Edit.Text := WebEdit1.Text;
try
// excute form and wait for close
TAwait.ExecP<TModalResult>(newform.Execute);
ShowMessage('Form 2 closed with new value:"'+newform.frm2Edit.Text+'"');
WebEdit1.Text := newform.frm2Edit.Text;
finally
newform.Free;
end;
end;
I used this in the multiform demo but it doesn't work, I gather because the form Create() routine with an ElementID calls Load() implicitly?
Thanks!
Try something like this if you want to assign a form to a webpanel.
procedure AfterCreate(AForm: TObject);
ChatForm := TChatForm.CreateNew(ChatPanel.ElementID, @AfterCreate);
procedure TMainForm.AfterCreate(AForm: TObject);
begin
if Assigned(ChatForm) and (ChatForm is TChatForm) then
begin
ChatForm.Parent := ChatPanel;
ChatForm.Align := alClient;
Chatform.CloseChatForm := BtnChatFormClick;
end;
end;
Hi,
Thanks for the reply, appreciate it; however, I'm referring exclusively to using await. I spoke with Bruno about this in another topic.
Thanks!
would this work?
newform := Await(TForm2.Create(WebPanel1.ElementID));
Hi,
Thanks for the reply but it doesn't compile, sorry.
Thanks!
I think I’ve asked something similar in this thread:
Related Topic