PDA

Click to See Complete Forum and Search --> : [DELPHI] - Simple MDI Problem! [RESOLVED]


Madboy
Aug 20th, 2005, 12:43 PM
So simple i feel sad asking :blush:

Basically ive not done much MDI programming before in Delphi, and my question goes like:

If i create a new child form, i want the child caption to say "Child 1", then if i create another document it will say "Child 2", "Child 3" etc.

Here is what ive got so far:

procedure TfrmMain.NewFile;
var
FormCount: LongInt;
begin
TfrmEdit.Create(self);
TfrmEdit(ActiveMDIChild).Caption:= 'Child ' + intTostr(FormCount + 1);
end;

But each new child shows Child 1 as the caption

Madboy
Aug 20th, 2005, 03:02 PM
The logic is simple now i realised:

procedure TfrmMain.NewFile;
var
NewForm: TfrmEdit;
begin
NewForm:= TfrmEdit.Create(Self);
NewForm.Caption:= 'Child ' + intTostr(MDIChildCount);
end;