How to refer to controls in a MDI form

I'm making an html editor with an mdi interface. I've added all the menus in the main form (is that ok?). So far so good.
However problems arised. I'm trying to make the File - Open menu work, but I don't know how to refer to the rich edit box located in the mdi form.

This is the code I'm using.
{Everything seems OK, but though this code doesn't compile because Child is TMDIChild and MainForm.ActiveMDIChild is TForm.}

Main form:

procedure TMainForm.mniArchivoAbrir(Sender: TObject);
var
  Child: TMDIChild;
begin
  Child := MainForm.ActiveMDIChild;
  SaveDialog.Filter := 'Archivos HTML (*.htm, *.html)|*.HTM;*.HTML';
  if SaveDialog.Execute then
    Child.Guardar(SaveDialog.FileName);

MDI form:

procedure TMDIChild.Guardar(Nombre: string);
begin
 reKeines.Lines.SaveToFile(Nombre);
end;


What can i do?

thanks.
pin_plunderAsked:
Who is Participating?
 
rwilson032697Connect With a Mentor Commented:
.. and yes, putting the menus in your main form is fine..

Cheers,

Raymond.
0
 
rwilson032697Commented:
Try writing this line:

 Child := MainForm.ActiveMDIChild;

like this:

 Child := MainForm.ActiveMDIChild as TMDIChild;

I assume Guardar is a public method of TMDIChild?

Cheers,

Raymond.

 
0
 
pin_plunderAuthor Commented:
thanks a lot.
0
All Courses

From novice to tech pro — start learning today.