ShowModal form behind Showmodal form Delphi Firemonkey multi device project

  

In a FMX multi device project I show a form with ShowModal()
and on an event of that form I call another form with ShowModal() without closing the 1st one.
But this second form stays behind the first form.

How can I set the 2nd form to be on top of the 1st form without closing the 1st form?

I’ve tried to set:

`FormStyle` to `StayOnTop`
Call `Form1.SendToBack`
Call Form2.BringToFront

The only way I have managed to accomplish to show the second form is by hiding the 1st form and showing it again when second form is closed.

But if possible I like to just always show the second form on top without hiding the 1st.

Is this possible?

UPDATE

Below code on how both forms are created.

NOTE: Both form2 and form3 are transparent. Maybe this has something to do with it? I’ve had problems with this before.

procedure TForm1.Button1Click(Sender: TObject);
var
form2: TForm2;
begin
form2 := TForm2.Create(nil);
form2.ShowModal(
procedure(ModalResult: TModalResult)
begin
if ModalResult = mrOk then
begin
//Some Code
end;
end);
end;

procedure TForm2.Button1Click(Sender: TObject);
var
form3: TForm3;
begin
form3 := TForm3.Create(nil); // I’ve tried to set the owner, this didn’t help
form3.Parent := Self; // Here I’ve tried to set parent form2 and even form 1
form3.ShowModal( // This form is shown behind form2
procedure(ModalResult: TModalResult)
begin
if ModalResult = mrOk then
begin
//Some Code
end;
end);
end;

So as you can see 2 forms are created showmodal.
Form1 is opened with Show instead of showmodal.
Form2 is created with a buttonclick event on form1
and form3 is also created with a buttonclick event, but on form2.

Comments are closed.