Page 1 of 1
open download window
Posted: Thu Feb 27, 2025 11:20 pm
by ericktux
Hello everyone, is there a way to open the download box? I have noticed that it appears when a file is finished downloading and gives options to open the location and run the downloaded file.
In WebView4Delphi I do it like this:
Code: Select all
WVBrowser1.OpenDefaultDownloadDialog;
PS: Is there a way to manage the progress of the downloads like Google Chrome or should I implement it myself?
Re: open download window
Posted: Fri Feb 28, 2025 7:45 am
by salvadordf
Hi,
If you want to use the user interface of Chromium then you can call
TChromiumCore.ExecuteChromeCommand(IDC_SHOW_DOWNLOADS, CEF_WOD_CURRENT_TAB); or navigate to
chrome://downloads/ to show all the downloads.
If you prefer to use a custom interface and to control each download then use the following methods, properties and events :
- TChromiumCore.DownloadBubble : Disable this property to hide the download notification.
- TChromiumCore.OnCanDownload
- TChromiumCore.OnBeforeDownload
- TChromiumCore.OnDownloadUpdated
- TChromiumCore.StartDownload
- TChromiumCore.DownloadImage
- TChromiumCore.OnDownloadImageFinished
Read the code comments for all of them and see the MiniBrowser demo :
https://github.com/salvadordf/CEF4Delphi/blob/cfba87c4d0964f6ccf943b2f5633217684733c11/demos/Delphi_VCL/MiniBrowser/uMiniBrowser.pas#L494
Re: open download window
Posted: Fri Feb 28, 2025 3:21 pm
by ericktux
Thank you very much Salvador for your help, it works.
One question: I'm using the "MiniBrowser" demo, how can I open an independent window pointing to chrome://downloads/ when starting a download?
Thank you very much for your time and help
Re: open download window
Posted: Sat Mar 01, 2025 8:19 am
by salvadordf
The MiniBrowser demo sets Chromium1.MultiBrowserMode to True in order to handle all popup windows with one TChromium component.
Try calling TChromiumCore.ExecuteChromeCommand(IDC_SHOW_DOWNLOADS, CEF_WOD_NEW_POPUP) in the TChromiumCore.OnBeforeDownload event
Enabling the MultiBrowserMode property will show all popup windows with the Chromium user interface. If you want to use Delphi forms then set Chromium1.MultiBrowserMode to False and use the code in the PopupBrowser2 demo to handle popup windows with Delphi forms.
Re: open download window
Posted: Mon Mar 03, 2025 7:40 am
by ericktux
Thank you very much, I will try it