Nothing works from everything I've tried.
Also, I abandoned the idea of making a modal window.
The problem is that I can't close the non-modal window so that the Main form reappears.
We showed you how it would work.
You can make a new small project with main form and secondary form and just try it with that. It'll probably work. Then you can find out why it doesn't in your big project.
I agree that run a secondary window in the MainFormActivate() was not a good idea. But it's not better with the MainFormShow().
As I already said... I worked put it in the OnCreate (TForm1.FormCreate). Not OnShow.
The main form is not visible yet but it will show the secondary form as modal.
Sort of a splash or login form. (was that what you were going for?)
Here's what I did or tried to do next:
I thought that the secondary window (FormIdentif) should only be launched if the user identification has not yet been done and I created the global variable IdentifOK to store the information.
So it's a login form.
I would definitely use a showmodal for that.
Or block the main menu ir action until you are sure the credentials are correct.
But all this doesn't work either: when I click on the "continue button", the MainForm does not appear and the procedure actually loops.
Yep. In the login you call mainform.show which triggers the event again.
I think your first draft with showmodal should have worked but I think you have something in your code which gives you problems. That's why it's best to create a small sample project to show it should work.
BTW. Isn't there a special login component which you can use (with username and password). Or do you have other special things on you login form?
Good night 😴