?
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
Medium Priority
?
503 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 200 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses

762 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