I have a few forms that open each other
Form 1 opens form 2 opens form 3 opens form 4
When I close form 4, form 2 is shown instead of form 3.
How can I make sure that form 3 is shown when form 4 is closed?
In my own experiments the chain of opened forms reopens the previous form when the last one is closed. Maybe your effect depends on the creation order (order of the Application.CreateForm calls in the lpr file) - I did not check that.
But in any way, I would not rely on any order. When you show forms using their Show method, instead of ShowModal, the forms are independent of each other, and the user has great flexibility in accessing each form. When the user selected Form2 before Form4 is closed the focus will return to Form2, not to Form3. What prevents the user from doing this? The user even could have closed (and destroyed) Form3, so that forcing to re-show Form3 as in winni's post could even crash your program.
What I want to say is that you must be very careful when working with several forms which depend on each other in a specific way. Only when Form3 shows Form4 with ShowModal you can be sure that Form3 will get focus after closing Form4 - of course, the user cannot navigate to the other forms while Form4 is open.