DelphiFAQ Home Search:

Progress bar with the TWebBrowser component


commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.


How can I make the TWebBrowser component display a progress bar?


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
    ProgressBar1.MaxValue := ProgressMax;
    ProgressBar1.Position := Progress
  end { Progress>0 }
    ProgressBar1.Progress := 0
end; { TForm1.WebBrowser1ProgressChange }
You don't like the formatting? Check out SourceCoder then!