I show a form with Form.ShowModal. The form has two buttons with ModalResult mrOK and mrCancel respectively. (this is very standard stuff..)
This worked fine in the past to close the dialog, now for some strange reason clicking on the button simply does nothing.
If I change the ModalResult to mrNone, and instead add event handler
procedure TShortCutsForm.btnOKClick(Sender: TObject);begin ModalResult := mrOK; Close;end;
Again, nothing happens.
Any ideas what is happening? Why Modal form is not closing when ModalResult is set?
This was working fine, now suddenly stopped working. I'm using Tokyo 10.2.3
Thanks people for the suggestions.
I did find the cause of the problem. Nothing wrong in the code for the modal dialog. Before showing the Modal I create a TFrame and then Free it (for some related purpose). Recently I added code to create a Thread in the Frame. What is happening is that the Thread terminates after the TFrame has been freed.
If I make some changes to what is called before I show the Modal Dialog, then indeed an error comes up. However, as things were, no error occurs (even when running in the IDE). However it seems that there is some internal error that blocks the Dialog from closing..
Emailx45 said:Check the flow of your coding through "debug", I believe there may be a loss in the middle, ie the code is valid but is not reaching the necessary point, for example, I am destroying an existing object, it is not the object on which it should work. Understood?