Henry Olive 5 Posted yesterday at 01:21 PM Good Day I want to find out the Form Name 1 level behind of Active Form In Form1 - Form2.Show; In Form2 - Form3.ShowModal; In Form3 I need the name of 1 level behind Form3, ( which is Form2 ) Thank You Share this post Link to post
Uwe Raabe 2094 Posted yesterday at 02:14 PM There are different approaches: Everytime a form takes focus it inserts itself at the top of Screen.CustomForms ShowModal inserts the previously focused form at the top of Screen.SaveFocusedList Share this post Link to post
Henry Olive 5 Posted 3 hours ago Thank you so much Uwe If you have time, could you please a little bit explain the 2 choices and if possible could you show some code example Share this post Link to post
David Heffernan 2380 Posted 3 hours ago @Henry Olive A Delphi programmer will be able to come up with the code give the information above. There is documentation and VCL source. If you don't have a Delphi programmer on your team you have bigger problems. Share this post Link to post
Die Holländer 67 Posted 2 hours ago Don't set Form2 and Form3 autocreated but create them yourself. You can use the "Owner" of the forms to get the name. In Form 1 you do: uses Unit2; procedure TForm1.BitBtn1Click(Sender: TObject); var Form2: TForm2; begin Form2 := TForm2.Create(Self); Form2.Show; end; In Form2 you do: uses Unit3; procedure TForm2.BitBtn1Click(Sender: TObject); var Form3: TForm3; begin Form3 := TForm3.Create(Self); Form3.ShowModal; end; In form 3 you can do: (try to find a way to do this recursively..) procedure TForm3.BitBtn1Click(Sender: TObject); var FormName: string; begin if Assigned(Owner) and (Owner is TForm) then Begin FormName := TForm(Owner).Name; if Assigned(TForm(Owner).Owner) and (TForm(Owner).Owner is TForm) then Begin FormName := TForm(Owner).Owner.Name; End else FormName := 'No Owner'; End else FormName := 'No Owner'; ShowMessage('The form is: ' + FormName); end; Share this post Link to post