Nadya Posted January 15, 2021 Share Posted January 15, 2021 Hi! I have modal forms in application. In the OnClose event I need to cancel form closing. I check conditions and set Action := caNone but it doesn't work. Form closes anyway. I've made a testcase for demonstrate. Testcase - ModalWinOnClose.zip To check out - please press the "Show nonmodal form 1" button on main form, then press the "Show modal test form" button to call modal form. If checkbox "Can close form" not checked - form should not be closed but Action := caNone is ignored What's wrong? Thank you in advance! Link to comment Share on other sites More sharing options...
Sherzod Posted January 15, 2021 Share Posted January 15, 2021 Hi Nadya! We will check this behavior. Link to comment Share on other sites More sharing options...
Nadya Posted January 19, 2021 Author Share Posted January 19, 2021 On 1/15/2021 at 10:02 AM, Sherzod said: Hi Nadya! We will check this behavior. Thanks! I'll be waiting 1 Link to comment Share on other sites More sharing options...
vbdavie Posted June 22, 2021 Share Posted June 22, 2021 Did anybody reply to you in another thread? Because I don't see any answer in this thread. I am wanting the same thing. IE: To be able to STOP the form from closing... 1. Client side keeps form displayed 2. Server side does NOT continue execution to the line after the ShowModal line of code. Thanks Davie Link to comment Share on other sites More sharing options...
Oliver Morsch Posted June 23, 2021 Share Posted June 23, 2021 You could also try "OnCloseQuery". Link to comment Share on other sites More sharing options...
vbdavie Posted June 23, 2021 Share Posted June 23, 2021 I don't see any OnCloseQuery in the UNIGUI system for TuniForm, unless I'm missing something;. I think it's in the VCL, but not the UNIGUI. Right? DAvie Link to comment Share on other sites More sharing options...
Oliver Morsch Posted June 24, 2021 Share Posted June 24, 2021 Sorry, this event is really only in the VCL, not in UniGUI. But on my older UniGUI version it works like expected with "action := caNone". Link to comment Share on other sites More sharing options...
vbdavie Posted June 24, 2021 Share Posted June 24, 2021 HUH, so you are saying that a much older version of UIniGUI DID support the OnCloseQuery ? Too bad they removed a valuable feature. DAvie Link to comment Share on other sites More sharing options...
estrify Posted June 24, 2021 Share Posted June 24, 2021 Hi, Use the "OnClose" event of the form: procedure TMainForm.UniFormClose(Sender: TObject; var Action: TCloseAction); begin if <some condition> then Action:= caNone; end; Regards, Link to comment Share on other sites More sharing options...
Oliver Morsch Posted June 24, 2021 Share Posted June 24, 2021 17 minutes ago, vbdavie said: HUH, so you are saying that a much older version of UIniGUI DID support the OnCloseQuery ? No, the "OnClose" event with "action := caNone" works for me. Link to comment Share on other sites More sharing options...
vbdavie Posted June 24, 2021 Share Posted June 24, 2021 Does NOT work for me. the line of code that contains the ShowModal method (blocking until form closes) falls down to the next line of code even when I use the caNone. If the form truely didn't close, then it shouldn't continue execution after the ShowModal line of code... right? Davie Link to comment Share on other sites More sharing options...
Oliver Morsch Posted June 24, 2021 Share Posted June 24, 2021 Then try to use a callback... Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now