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
495 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_
2 Comments
 
LVL 32

Accepted Solution

by:
ewangoya 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This video teaches viewers about errors in exception handling.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now