Js closes the program.
The situation is
That when js calls window.close the form on which TCEFWindowParent hangs is trying to close. I don’t need it spoils the entire program system if I stop putting some variables in FormCloseQuery. As I understand it, this is just a post message that can be deleted and that’s it. Only where I do not know. in which module. I will track that this happens when TCEFWindowParent is deleted. farther Code stoped it doesn’t go and FormCloseQuery is called,
to me really need to find either this line in the modules or another solution without adding code to FormCloseQuery
This happens with window.close in other cases, everything works well.
I use before closing the browsers event through synchronization I delete Parent and as soon as it succeeds immediately for some reason FormCloseQuery is called
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.
Js closes the program.
Js closes the program.
Last edited by dvbss11 on Sun May 03, 2020 8:26 am, edited 1 time in total.
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Js closes the program.
Try using the TChromium.OnClose event and add this code line :
Code: Select all
aAction := cbaCancel;
Re: Js closes the program.
does not help TCefCloseBrowserAction = (cbaClose, cbaDelay, cbaCancel); everyone calls FormCloseQuery
this form is not the main
this form is not the main
- salvadordf
- Posts: 4575
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: Js closes the program.
I modified the MiniBrowser demo with this code in the TChromium.OnClose event :
Then I loaded this page to test the "window.close" call :
https://www.w3schools.com/jsref/tryit.a ... _win_close
I clicked the "Open myWindow" button to create a popup window and then I clicked the "Close myWindow".
The code in the TChromium.OnClose event sets aAction := cbaCancel; for the popup window and it remains open.
Setting the aAction parameter seems to work correctly. If you have a different situation please provide the code to reproduce this issue.
Code: Select all
procedure TMiniBrowserFrm.Chromium1Close(Sender: TObject; const browser: ICefBrowser; var aAction : TCefCloseBrowserAction);
begin
if (browser <> nil) and (Chromium1.BrowserId = browser.Identifier) then
begin
PostMessage(Handle, CEF_DESTROY, 0, 0);
aAction := cbaDelay;
end
else
aAction := cbaCancel;
end;
https://www.w3schools.com/jsref/tryit.a ... _win_close
I clicked the "Open myWindow" button to create a popup window and then I clicked the "Close myWindow".
The code in the TChromium.OnClose event sets aAction := cbaCancel; for the popup window and it remains open.
Setting the aAction parameter seems to work correctly. If you have a different situation please provide the code to reproduce this issue.