TWebFrame and TWebDBGrid

I have made a simple Demo and put a TWebPageControl on my mainform.
Then I added a TWebFrame formular with only a TWebDBGrid on it.
In my mainform I added the following code on a button:


      FDataFrame1 := TDataFrame1.Create(Application);
      FDataFrame1.Visible := True;
      FDataFrame1.Parent := tsData1;
      FDataFrame1.Align := alClient;
      FDataFrame1.Name := 'Test';
      FDataFrame1.LoadFromForm;

But he does not show the grid, I can see HTML code.

The grid on the Mainform added in the IDE works correct.

I cannot see a problem.
Here is code that adds a frame at runtime on a PageControl TabSheet
Project1.zip (6.4 KB)

Hi Bruno,

thank you for your demo.

Try this, and please tell me why this does not work.
I have changed the two commentet lines.

// Frame11 := TFrame1.Create(Self);
// Frame11.LoadFromForm;
Frame11 := TFrame1.Create(Application);
Frame11.SetParentComponent(WebPageControl1);
Frame11.Name := 'Frame11';
Frame11.Left := 32;
Frame11.Top := 32;
Frame11.Width := 640;
Frame11.Height := 480;
Frame11.TabOrder := 3;
Frame11.LoadFromForm;

LoadFromForm needs to be called before setting the parent. You can compare LoadFromForm to loading what is in the DFM file in a VCL app and this needs to happen before the form HTML effectively gets created when the parent is set.

Ok, perfect. Works in my demo, and in my program, that I am currently developing...