Solved

How can i get the name of the Form, that i've called Showmodal one step before ( parentform )

Posted on 2011-02-15
2
498 Views
Last Modified: 2012-05-11
Hello,

i am using Delhpi 7, and would like to get the parent form name after called Showmodal.

when i place a button on the main form ( called : Main_1 ), and create a new form ( called . Parent_1 ), the buttonclick does : showmodal Parent_1.

and when the active form is Parent_1, i wolud like to get it's parent name ( Main_1 ).

can anyone help me?
regards
Tamas
0
Comment
Question by:RT_
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
Ephraim Wangoya earned 50 total points
ID: 34897934

Two ways I can think of

1. Make the calling form the Owner of the form being created

    Form2 := TForm2.Create(Self);  //where self is the current form

    Then in Form2 to get the calling forms name/title you can use
    if (Owner is TForm) then
       TitleOfCaller := TForm(Owner).Caption
    //or
    //nameOfCaller := TForm(Owner).name

2.   Add the parent form title to the form and pass it on create

    TForm2 = class(TForm)
    .........
    private
       FParentFormTitle: string;
     ........
    public
       property ParentFormtitle: string read FParentFormTitle write FParentFormTitle;
    end;

    when calling from MainForm
    Form2 := TForm2.Create(Application);
    try
      Form2.ParentFormTitle := Caption;
      Form2.ShowModal;
    finally
      FreeAndnil(Form2);
    end;


0
 

Author Closing Comment

by:RT_
ID: 34898098
lot of thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question