Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
?
513 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

This article will show, step by step, how to integrate R code into a R Sweave document
The purpose of this article is to demonstrate how we can use conditional statements using Python.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
Suggested Courses

618 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