Forum > Designer
SOLVED Impossible to close a modal window...
n7800:
I just checked and Close or ModalResult should work.
But the code in the OnActivate event always bothers me. It can cause problems.
For example, if you write Show instead of ShowModal in your program, the window will close, focus will switch to the first form, which will activate the OnActivate code, and it will open the second form again. This will happen very quickly and will look like it never closed.
That's the first thing I thought of when I saw the event. However, for modal forms this does not cause a loop and the form closes...
pjtuloup:
Thank you very much for the advice... and taking risks. I will study this.
I have to say that I am grateful for the warnings since you are experienced, but I don't understand why you say that I am trying to close a modal window from outside the form, since my "continue" button that wants to close the form is indeed in this form?
rvk:
--- Quote from: Thaddy on July 03, 2024, 09:48:57 am ---You can't easily close a modal window from somewhere else. You close a modal Window from the modal window itself.
--- End quote ---
Have I read the question wrong... or did you???
TS says (s)he want's to close the modal form IN THE MODAL FORM itself via a button TFormIdentif.Btn_ContinuerClick.
The only problem I see with the code is that it calls the instance variable itself "FormIdentif" and not using "Self." or just using ModalResult directly (without FormIdentif in front).
ModalResult:= mrOK; should have been sufficient in that button-event on the modal form.
Edit:
--- Quote from: pjtuloup on July 03, 2024, 10:21:45 am ---I have to say that I am grateful for the warnings since you are experienced, but I don't understand why you say that I am trying to close a modal window from outside the form, since my "continue" button that wants to close the form is indeed in this form?
--- End quote ---
Yes. Exactly. Ignore grumpy Thaddy. He doesn't always read the questions carefully.
MarkMLl:
--- Quote from: pjtuloup on July 03, 2024, 10:21:45 am ---Thank you very much for the advice... and taking risks. I will study this.
I have to say that I am grateful for the warnings since you are experienced, but I don't understand why you say that I am trying to close a modal window from outside the form, since my "continue" button that wants to close the form is indeed in this form?
--- End quote ---
I was being cautious after Thaddy's interpretation :-/
Apart from that: you don't really need to close the form as such, just exit it using the appropriate button.
MarkMLl
Thaddy:
Rik, my mother taught me speed reading when I was 5 but never mentioned the disadvantages..So I ignore them by habit :(
Navigation
[0] Message Index
[#] Next page
[*] Previous page