Hello!
I'm using the SimpleBrowser demo (from release 87.0.4280.141)
I've added a form that merely opens the SimpleBrowser form with ShowModal
In TFormSimpleBrowser I've added a button that sets its ModalResult to mrOk
When I press the button, ModalResult is set to mrOk but it is changed during the closing process of SimpleBrowser
Following this sequence:
FormCloseQuery : ModalResult = mrOk
ChromiumWindow1Close : ModalResult = mrNone
FormCloseQuery : ModalResult = mrCancel
Why?
Thanks in advance for any help or tips
Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
ModalResult value changes during closing process
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: ModalResult value changes during closing process
Hi,
The source code in CEF4Delphi doesn't modify the ModalResult property.
The VCL code in "Vcl.Forms.pas" on the other hand changes the TCustomForm.ModalResult value several times :
The source code in CEF4Delphi doesn't modify the ModalResult property.
The VCL code in "Vcl.Forms.pas" on the other hand changes the TCustomForm.ModalResult value several times :
- TCustomForm.Close
- TCustomForm.CloseModal
- TCustomForm.ShowModal
Re: ModalResult value changes during closing process
Thank you very much for your answer!
Because if I remove the call to: then ModalResult isn't changed
My problem is that I cannot use a Yes-No dialog and get the correct answer in a form that has Chromium browser with your recommended closing process
ikr but maybe cef does...The source code in CEF4Delphi doesn't modify the ModalResult property.
Because if I remove the call to:
Code: Select all
ChromiumWindow1.CloseBrowser(True);
Yes but "Vcl.Forms.pas" doesn't alter TCustomForm.ModalResult final value if it was set on purpose by the userThe VCL code in "Vcl.Forms.pas" on the other hand changes the TCustomForm.ModalResult value several times
My problem is that I cannot use a Yes-No dialog and get the correct answer in a form that has Chromium browser with your recommended closing process
- salvadordf
- Posts: 4580
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: ModalResult value changes during closing process
The browser destruction cancels the first form close to close the browser properly and then retries closing the form.
Perhaps the VCL code resets the ModalResult value after the first step.
Save the ModalResult value before cancelling the form closure.
Perhaps the VCL code resets the ModalResult value after the first step.
Save the ModalResult value before cancelling the form closure.
Re: ModalResult value changes during closing process
Thanks!
This is what I've already done to fix it but I wanted to be sure that I wasn't missing something obvious...Save the ModalResult value before cancelling the form closure.