Olexandr Strelchenko
Olexandr Strelchenko

Reputation: 313

Form appears after 'Application.CreateForm' step

I am working on a project in delphi 2007 (CodeGear RAD Studio). There are couple of forms in the application. Thouse forms are created as follows:

program MyProgram;

uses
    Forms,
    uMain in 'Source\uMain.pas'                 {MainForm},
    uSettings in 'Source\uSettings.pas'         {fSettings};

{$R *.res}

begin
    Application.Initialize;
    Application.CreateForm(TMainForm, MainForm);
    Application.CreateForm(TSettings, Settings);
    Application.Run;
end.

the problem is, that on line Application.CreateForm(TSettings, Settings); Settings form appears (not modal). And the question is why it is happening?.

I know that it is probably not enough information, but I am ready to provide some, if it is needed.

P.S. I am currently re-wrighting programm logic so settings form will be created only before it is about to appear, and after that delete it. Still, I would like to know the answer to this question.

Upvotes: 8

Views: 980

Answers (1)

iMan Biglari
iMan Biglari

Reputation: 4776

Your settings form's Visible property is set to true at design time, and thus it appears as soon as it's created.

Upvotes: 14

Related Questions