0

I am using delphi's TWebbrowser to navigate to a php file I created. I have a loading screen I would like to show when the page is loading or processing commands.

How can I detect when it is being refreshed or still loading.

currently I am using the ondocumentcomplete to close the loading form and re-enable the main form once loading is done.

I have tried the onbeforenavigate2 to show the loading screen and disable the main form. But then after it has finished loading, and the document completes, the navigate2 process is run again. And the form again disabled.

is there any way to detect when the browser is loading a page?

Zam
  • 2,880
  • 1
  • 18
  • 33
Marcel
  • 874
  • 1
  • 14
  • 28

1 Answers1

0

The events that you are searching for are OnDownloadBegin and OnDownloadComplete.

OnDownloadBegin fires just before the document starts to being downloaded and is therefore the best event for starting of some loading animation.

http://docwiki.embarcadero.com/Libraries/XE8/en/SHDocVw.TWebBrowser.OnDownloadBegin

OnDownloadComplete fires after the document was downloaded and even if the downloading of the document fails for some reason. So it is best even for stopping of some loading animation.

http://docwiki.embarcadero.com/Libraries/XE8/en/SHDocVw.TWebBrowser.OnDownloadComplete

SilverWarior
  • 7,372
  • 2
  • 16
  • 22
  • The commands aren't executed precisely... the form goes away a bit before I would like... but it will do thank you :). – Marcel Jun 16 '15 at 13:04
  • Then perhaps you would rather like to use OnProgressChange event, but it might be much trickier as the progress status is heavily dependant on server from which the site is hosted. – SilverWarior Jun 16 '15 at 13:28
  • 1
    Try [`this technique`](http://stackoverflow.com/a/10105697/960757) to determine whether the event has been fired for the main document. – TLama Jun 16 '15 at 13:32