I have a Firemonkey Multi Device(Android & iOS) Project in Rad Studio 10 Seattle. I want to call a form with showmodal from a method in a unit and give the modalresult back with the function.
I've tried the following examples below:
function ShowMyForm: TModalResult;
var
form: TForm1;
begin
form:= TForm1.Create(nil);
form.ShowModal(
procedure(ModalResult: TModalResult)
begin
result := ModalResult;
end);
end;
function ShowMyForm: TModalResult;
var
form: TForm1;
begin
form:= TForm1.Create(nil);
result := form.ShowModal;
end;
With the inline procedure the function can't access the result.
And just calling TForm.ShowModal doesn't work on a multi device project.
Is there an other way to achieve this?
ShowModalis not blocking. This means that your functionShowMyFormis complete before the modal form is executed. Instead do as docs says, callShowand let the form return and call your event. - LU RD