bazzer747 25 Posted October 24, 2022 (edited) Hi, I have an application with a main form - fSloggs - with a button that opens another form - fMatchResult - with: fMatchResult.Show; However, this other form pops up immediately after the FormCreate of the fSloggs form and before the FormActivate of the form. The source for the executable looks like this: program PGCSloggs; uses Vcl.Forms, uSlogg in 'uSlogg.pas' {fSloggs}, Vcl.Themes, Vcl.Styles, dm in 'dm.pas' {dm1: TDataModule}, uMatchResult in 'uMatchResult.pas' {fMatchResult}, {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(Tdm1, dm1); Application.CreateForm(TfSloggs, fSloggs); Application.CreateForm(TfMatchResult, fMatchResult); Application.Run; end. I can't see any reason why the fMatchResult form should pop up without the button being pressed. Also, not sure what the 'Application.MainFormOnTaskBar:= True' is about. Any thoughts would be appreciated. Edited October 25, 2022 by Sherlock Please consider using the code tags for better readability Share this post Link to post
Uwe Raabe 2055 Posted October 24, 2022 Check if fMatchResult has its Visible = True in the designer and switch it off to fix the issue. Share this post Link to post
bazzer747 25 Posted October 24, 2022 Fixed!!! How simple .... How did this get set to visible = true anyway, I wonder. Many thanks ... I'd trawled though the Properties but that never occurred to me. Share this post Link to post
Stano 143 Posted October 24, 2022 It would be more correct to create the form only at the moment of need. Of course, this also depends on the logic of the program. Share this post Link to post
haley 2 Posted October 25, 2022 Personally, I'd rather not create the form until it's needed because apparently that makes it load faster, but I'm not an expert, LOL. 1 Share this post Link to post
bazzer747 25 Posted October 25, 2022 HI, Thanks Stano and Haley, you are both right (as was Uwe). I was auto-creating the form at startup. I've shifted it to the right in Project Options so it only gets created when the button is first pressed. The form isn't too big so loading times aren't an issue, but probably good practice. Thanks to all. Share this post Link to post