However, as you can see from below image, the popup form is not centered. Could you give me some advice about how to center popup form in runtime? thanks
When I add the code in the multiform demo to set width/height after the form load, this works:
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;
// programmatically change the size of the popup form here
newform.Width := 250;
newform.Height := 250;
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;
Thanks for getting back to me. I copied/pasted your code into the demo and set both height and width to 800. As indicated below, the initial positioning of popup form still does not properly align it at the center of the page