Hello,
When i try to acces to procedure in form1 from a another form, i got a error :
I open the form 2 like this
newform := TFafficherRdv.Create(Self);
newform.Popup := true;
await(TFafficherRdv, newform.Load());
newform.WebFormShow(self);
try
await(TModalResult, newform.Execute);
finally
newform.Free;
end;
and in form2 i call form1.refresh
declared in form1.
Thank you.
What is here form1 and form2 and where exactly do you call form1.refresh?
Sorry,
form1, it's main form and form2 it's "newform".
Anywhere in form2, in tbuttonOnlick event.
In the debugger, when i call form1.refresh(), form1 is null
I retested this with adding a button to form2 in demo Demo\Basics\MultiForm with code:
procedure TForm2.WebButton1Click(Sender: TObject);
begin
form1.WebLabel1.Caption := 'Updated';
end;
and this works as expected. Please compare your app with this demo.
It's same.
I added a a new TMS WEB form "form3" in the demo Demo\Basics\MultiForm. with a button
procedure TForm3.WebButton1Click(Sender: TObject);
begin
Form2.frm2Edit.text := 'update..';
end;
my form 3 is instancied like this :
procedure TForm2.WebButton1Click(Sender: TObject);
var
form3: TForm3;
begin
form3 := Tform3.Create(Self);
form3.Popup := true;
await(Tform3, form3.Load());
try
await(TModalResult, form3.Execute);
finally
form3.Free;
end;
end;
And i have the same error
For information :
Unit3 is displayed with extension "Unit3.pas" and Unit2 & Unit1 are showned whitout extension .
Thank you.
This is because in the creation of a TForm2 instance, Form2 variable is not set.
So, add in your code with TForm2 creation to set the Form2 variable.
TMSWeb_Multiform.zip (56.1 KB)
Ok, it's work, Thank you.
So, i have to set the form for each form created.
If you want to access it this way, yes.
system
(system)
Closed
July 21, 2023, 12:45pm
9
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.