Mega Code Archive

 
Categories / Delphi / Examples
 

Progress bar with the twebbrowser component

Question: How can I make the TWebBrowser component display a progress bar? Answer: The TWebBrowser component cannot display a progress bar on its own. You need to add a TProgressBar component from the Win32 component palette and hook into the TWebBrowser.OnProgressChange event as shown in the code below. procedure TForm1.WebBrowser1ProgressChange(Sender: TObject; Progress, ProgressMax: integer); begin { TForm1.WebBrowser1ProgressChange } if Progress>0 then begin ProgressBar1.MaxValue := ProgressMax; ProgressBar1.Position := Progress end { Progress>0 } else ProgressBar1.Progress := 0 end; { TForm1.WebBrowser1ProgressChange }