Auto height for popup form based on its content

In a bootstrap template based app, I have a popup form opened.
Popup form's element style is set by web core in order to show it as modal popup.
The thing I want to avoid is setting of the form's height to fixed pixels (650px).
I want form's height to be variable based on the contained div's height.
When I manualy unset the height in the console it works fine.

My question is how can I do this in the code?


Should be possible to remove this in code with:

This gives compilation error:

This version compiles:'height');

But give null pointer exception during runtime.

When do you call this? It is likely you call this when the form's HTML container element was not yet created.

I call like this:

  frmTranscriptionJob := TfrmTranscriptionJob.Create(Self);
    frmTranscriptionJob.Popup := True;
    frmTranscriptionJob.PopupOpacity := 0.5;
    Await(TfrmTranscriptionJob, frmTranscriptionJob.Load());'height');

Thanks Bruno,
I solved it like this for the time being. It is better than setting forms height during design time. Since the total height of the internal items may change due to theme ect.

procedure TfrmTranscriptionJob.WebFormCreate(Sender: TObject);
  Height := divContainer.Height;
  Top := Floor((Application.MainForm.ClientHeight - Height) / 2);