Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MDI problem

Status
Not open for further replies.

systweak

Programmer
Sep 12, 2005
1
IN
Hi!

I am using a mdi application. I have a parent form and two diffrent mdi childs. One child one i have a text box and i want to set the text of the textbox from the second mdi child form.

Can u help me out....
 
You should be able to use parent.mdichildren to get to the textbox on the second child form.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
I am unable to get what you r asking me to do.
I think i have not made it clear.
I have a mdi parent and two childs. Child one is created on runtime and child two is created only once.
When i load the parent there is a menu which crated and displays the first child. When the first child is displayed i click on another menu and the child two is displayed used to make settings for the mdi child 1, like text and font color.

The problem that i am facing is that when i write on the child 2
Tfrmchild(ActiveMDIChild).txttext.text:='Amol';
the program give me a access violation error.

 
Since you don't currently have a reference to first child from the 2d child and vice versa, you'll have to do a couple of things to get there:

1. Add a property to ChildForm2 called CallingForm and give it the same type as your ChildForm1 (TForm, I assume.)

2. In the button-click event handler that displays ChildForm2, add code similar to the following PRIOR to showing the form: ChildForm2.CallingForm := self;

3. In the button-click event handler where you're trying to set the value in the text box, add code similar to this:
CallingForm.textbox1.text := textbox2.text;

4. Finish whatever other processing you need and hide ChildForm2.

-Dell


A computer only does what you actually told it to do - not what you thought you told it to do.
 
HI!

Well i am using delphi 7 and how do i get calling form property. Please be a bit more clear. I want to set the properties of a object on a mdi child 1 from a mdi child 2. There may be many instances of mdi child 1...

Can u have a code snippt for this.


Thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top