Henry Olive 5 Posted February 23 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 2129 Posted February 23 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 February 24 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 2404 Posted February 24 @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 82 Posted February 24 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