When showing a secondary form from the main form and from the second form showing a third form and then closing both forms will cause the main form to lose focus.
Using Delphi 2009 with XP SP3
Here are my steps for reproducing the problem:
- Create a new VCL forms applications
- Drag a button onto the created form
- In the click handler create a new TForm1 and show it
Run the program. Click the button to show a second form. Click the button on the second form to create a third form. When closing both new forms the main form will lose its focus.
This is my code in the button click event handler:
// Using Self does not change the results with TForm1.Create(nil) do show;
Is there any way to stop my main form from losing focus?