I have a simple MDI app in which the children all have the DreamMemo component on. My problem is that when I have multiple documents open, I don't know how to access the correct memo to save the contents to disk.
My code is based on one of the MDI demos supplied with Delphi5, so the children are opened with:
Child := TMDIChild.Create(Application);
Child.DCMemo1.Lines.LoadFromFile(Name);
... but the demo doesn't have any code in the Save or SaveAs sections and if you try to use:
Child.DCMemo1.Lines.SaveToFile(Name);
... it says that 'Child' is an undeclared identifier - even though it is used earlier in Main when the children are created.
I did a search on here and found a suggestion which said to use MDIChildren[0], but the line:
MainForm.MDIChildren[0].DCMemo1.Lines.SaveToFile(Name);
... then says 'DCMemo1' is an undeclared identifier although:
ShowMessage(MainForm.MDIChildren[0].Name);
... works fine.
I'm obviously being very stupid here, so can someone point me in the right direction please?
Barrie
My code is based on one of the MDI demos supplied with Delphi5, so the children are opened with:
Child := TMDIChild.Create(Application);
Child.DCMemo1.Lines.LoadFromFile(Name);
... but the demo doesn't have any code in the Save or SaveAs sections and if you try to use:
Child.DCMemo1.Lines.SaveToFile(Name);
... it says that 'Child' is an undeclared identifier - even though it is used earlier in Main when the children are created.
I did a search on here and found a suggestion which said to use MDIChildren[0], but the line:
MainForm.MDIChildren[0].DCMemo1.Lines.SaveToFile(Name);
... then says 'DCMemo1' is an undeclared identifier although:
ShowMessage(MainForm.MDIChildren[0].Name);
... works fine.
I'm obviously being very stupid here, so can someone point me in the right direction please?
Barrie