Hi,
When creating form dynamically, as in the Multi-Form example, the form OnShow is called twice, once by Load(), and then by Execute().
What is the reason and how to avoid it?
Thanks,
procedure TForm1.WebButton1Click(Sender: TObject);
var
newform: TForm2;
begin
newform := TForm2.Create(Self);
newform.Caption := 'Child form';
newform.Popup := WebRadioGroup1.ItemIndex <> 0;
case WebRadioGroup1.ItemIndex of
2: newform.Border := fbDialog;
3: newform.Border := fbDialogSizeable;
end;
// used to manage Back button handling to close subform
window.location.hash := 'subform';
// load file HTML template + controls
await(TForm2, newform.Load());
// init control after loading
newform.frm2Edit.Text := WebEdit1.Text;
try
// excute form and wait for close
await(TModalResult, newform.Execute);
ShowMessage('Form 2 closed with new value:"'+newform.frm2Edit.Text+'"');
WebEdit1.Text := newform.frm2Edit.Text;
finally
newform.Free;
end;
end;