Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

Control the MDI parent from within the child

Hi experts,

I'm writing a MDI application with one main MDI form and several MDI childs. What I like to do is to access components on the main form from within the MDI child. For example: when the user enters some data in a MDI child form, I want to display some labels on the main form or put some text in the statusbar, which also resides on the main form.
I cannot simply define the main form in the uses-clause of the child because the child is already in the uses-clause of the main form, therefore a cross reference error is reported by the compiler.

Can anyone tell me how to do this?

Thanks,
JDN
0
JDN
Asked:
JDN
1 Solution
 
ITugayCommented:
specify MDI form bellow "implementation"


implementation
uses
  MainFormUnit;  

-----
Igor.


0
 
jswebyCommented:
ITugay is right. Don't put the main form in the uses clause at the top of the form, add a new uses clause in the implementation section of the unit and reference the main form in there.

In fact, if you just reference the main form in your code, when you compile you application, Delphi will ask you if you want to put the main form's unit in the uses clause.

J.
0
 
JDNAuthor Commented:
OK, thanks. This works fine!
0

Featured Post

Independent Software Vendors: 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!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now