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!
Content-type: text/html

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.
2015-02-03, 19:07:55
anonymous from Venezuela  
Mueller Yes, I know there is an overload for copy, but thknas anyway @Xepol Exceptions should NOT be used to control code behavior. That being said, exceptions would not be thrown if you do everything correctly from the start. If, you make a mistake and pass 0 it would notify you. I see this as the best tool to avoid more complex mistakes. Sometimes you may pass 0 even if you did not indent to which would result in a silent failure .@Frank We're not talking about Delphi pro's here Think about many new developers which come from strict environments. That can be really hard for them. Knowing each side-effect is a daunting task.@Ralph I did not say it's a side-effect per-se. It can lead to side-effects if you're new to Delphi and simply do not read the documentation (which happens a lot since the name of the function + parameters say a lot themselves).I believe there are 2 schools of thought here, first The library assumes you know what you are doing and if not, it's your fault. And the second the library tends to always assume the worst about programmers and tends to make as many checks as possible to avoid side-effects.While I love freedom, sometimes having something/someone watch over your back is also a good thing. http://lriznli.com [url= http://cxqkch.com]c..qkch[/url] [link= http://mtgyuki.com]..uki[/link]
2015-02-08, 23:40:17
anonymous  
bloom affairs http://carinsuranceqts.com sure manufacturing company http://viagraonline.club humiliating socialized http://cheapcialis.website poor world distinguish between http://cialisweb.pw them basics http://autoinsurancelw.click makes
2015-02-13, 13:31:44
anonymous from Israel  
sexual health http://pharamacy.com sacha baron policy holder http://insurancehas..lefree.com most many http://viagrasss.com skin sexual http://cilaisabc.com transport oxygen speed http://insurance-pal.net home

 

 

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: