The 'Synchronize' marshals the call back to the main thread so you are not really achieving anything by using a thread here.
You need to make the alert.Execute non-modal.
rather than calling 'Close' you should do
ModalResult := mrCancel;
which will close the form.
(you could also set the ModalResult property of the button to mrCancel and then you wouldn't need the event handler)
I think there is a misunderstanding here, Form1 is a variable which points at an instance of tForm1. That instance of tForm1 does not know about the variable Form1 and the only reason the first example works is because Form1 is global, and you *know* that it is pointing at the tForm1 instance...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.