on-internet
← Community

How to call ShowModal on a Form but not show it to the user?

Stack Overflow ·

I have this situation - from Form1, I want to call Form2, wait for Form2 to do its thing, and go back to Form1. But I don't want to show Form2. I'm doing something like this in Form1: procedure TForm1.button1Click(Sender: TObject); begin application.createform(tform2, form2); form2.visible := false; // has no effect form2.showmodal; showmessage('form2 done !'); end; It's working, except for the fact that I don't want to show Form2, but I need to wait for Form2 to complete its work. If I call Show() instead of ShowModal(), the procedure won't stop and shows 'form2 done' right away.

Comments

Sign in or sign up to comment and upvote.

No comments yet.