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.

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 }
You don't like the formatting? Check out SourceCoder then!

Comments:

2009-11-30, 09:12:15
anonymous from Serbia  
procedure TForm1.WebBrowser1ProgressChange(Sender: TObject; Progress,
ProgressMax: Integer);
begin
if Progress>0 then
begin
ProgressBar1.Max:= ProgressMax ;

ProgressBar1.Position := Progress;
end { Progress>0 }
else
ProgressBar1.Position:= 0 ;
end;
2015-02-01, 05:42:48
anonymous from Sweden  
This wetbise makes things hella easy.

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: