Print Page | Close Window

Hosting multiple forms in other controls

Printed From: TMS Software
Category: WEB
Forum Name: WEB Core
Forum Discription:
URL: http://www.tmssoftware.com/site/forum/forum_posts.asp?TID=11207
Printed Date: 24 Aug 2019 at 3:28pm


Topic: Hosting multiple forms in other controls
Posted By: Mitchell Hilary
Subject: Hosting multiple forms in other controls
Date Posted: 25 Jul 2018 at 8:21am
I was wondering, is it possible to host, let's say two forms in two panels side by side?



Replies:
Posted By: Bruno Fierens
Date Posted: 25 Jul 2018 at 8:24am
Yes that should be possible.


Posted By: Mitchell Hilary
Date Posted: 25 Jul 2018 at 8:48am
When I try to do following, only AfterCreate2 is being called, the form doesn't show show up. Form2 doesn't show up either and AfterCreate1 is not called at all.

Form2 creates fine and AfterCreate1 is called when I comment out
//Form3 := TForm3.CreateNew...
Form3 creates fine and AfterCreate2 is called when I comment out
//Form2 := TForm2.CreateNew...

var
  Form1: TForm1;
  Form2: TForm2;
  Form3: TForm3;

procedure TForm1.WebButton1Click(Sender: TObject);
  procedure AfterCreate1(AForm: TObject);
  begin
    if (Assigned(Form2)) and (Form2 is TForm2) then
      ShowMessage('Form2');
  end;
  procedure AfterCreate2(AForm: TObject);
  begin
    if (Assigned(Form3)) and (Form3 is TForm3) then
      ShowMessage('Form3');
  end;
begin
  Form2 := TForm2.CreateNew(WebPanel1.ElementID, @AfterCreate1);
  Form3 := TForm3.CreateNew(WebPanel2.ElementID, @AfterCreate2);
end;

I disabled automatic creation of Form2 and Form3 in Project file.


Posted By: Ibrahim Ahmed A
Date Posted: 25 Jul 2018 at 10:08am
is it possible to show them as windows,  that is as popup Dialog?


Posted By: Mitchell Hilary
Date Posted: 25 Jul 2018 at 10:37am
Not if I do this:
  Form2 := TForm2.CreateNew(@AfterCreate1);
  Form3 := TForm3.CreateNew(@AfterCreate2);
  Form2.Popup := true;
  Form2.ShowModal;

I get only white page (probably some part of the popup, it disappears when I click in the address bar, but no components that I actually put on the popup form).

If I don't load Form3 in the variable then it works fine.
  Form2 := TForm2.CreateNew(@AfterCreate1);
  Form2.Popup := true;
  Form2.ShowModal;


Posted By: Mitchell Hilary
Date Posted: 25 Jul 2018 at 1:18pm
Interestingly enough, it works if you don't create the two forms one after another but rather space it out in time. I think it is still an issue though.


Posted By: Bruno Fierens
Date Posted: 26 Jul 2018 at 3:25pm
We have applied an improvement for this. We'll release an update with this improvement asap.


Posted By: Mitchell Hilary
Date Posted: 21 Jul 2019 at 2:49pm
Hi, just a quick question, what is the fix for this issue?


Posted By: Bruno Fierens
Date Posted: 21 Jul 2019 at 3:05pm
Please install the latest version where this issue was addressed.



Print Page | Close Window