Am 14.11.2011 10:51, schrieb John Landmesser:
procedure TForm1.FormCreate(Sender: TObject);
begin
   // next line produces error
   Application.MainForm.Caption:= Application.Title;
   // next line does NOT produce an error
   Form1.Caption:= Application.Title;
end;

In FormCreate, the Form1 is not assigned to Application.MainForm. This is done after the complete creation process.

//BUT(!!),you get no error with the OnShow event

procedure TForm1.FormOnShow(Sender: TObject);
begin
   // next line does NOT produces  error
   Application.MainForm.Caption:= Application.Title;
end;

- the creation process is done
- then Form1 is assigned to Application.MainForm
- then Form1.Show is called

Please take a look into TApplication.CreateForm for further informations.

hth
Michael

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to