You can check fsModal in FormState for onShowEvent of your form.
I made you a small example:
Create a new project and add an additional form to it. Place two buttons on the main form and let them display the second form:
uses Unit2; procedure TForm1.Button1Click(Sender: TObject); begin Form2.Show; end; procedure TForm1.Button2Click(Sender: TObject); begin Form2.ShowModal; end;
No magic here: D
Then add OnShowEvent to your Form2 :
procedure TForm2.FormShow(Sender: TObject); begin if fsModal in FormState then Caption := 'ShowModal' else Caption := 'Show'; end;
That should do the trick for you.
Jens borrisholt
source share