Link to home
Start Free TrialLog in
Avatar of JDN
JDN

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Igor UL7AAjr
Igor UL7AAjr
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
Avatar of JDN
JDN

ASKER

OK, thanks. This works fine!