Can't close a form with biSystemMenu X button when loop executing
Posted on 2006-11-02
I call a form in my main application the following way: FrmAnimation.ShowModal;
From the FrmAnimation form I execute an Animation Procedure. While this Animation Procedure ( a while loop executing away) is active, I cannot close the form if I want to exit by pressing the X button from the System Menu. I made sure to add Application.ProcessMessages statements in the while loop, however the close action is not registered until I stop the while loop/Animation Procedure. The while loop is stopped if I click anywhere on the form. I click on the X button, while animation is ON, the form closes immediately after clicking on the form itself.
OnClose and OnCloseQuery are not executed when this while loop is executing.
Can anyone give me any ideas on how to close this form when animation is ON. I want to give the user the ability to close the form whenever they click the X button without delay. Any help is greatly appreciated.