?
Solved

ProgressBar in StatusBar Panel

Posted on 2003-03-29
5
Medium Priority
?
1,036 Views
Last Modified: 2007-12-19
Please..Please...
how can i add a progressbar to a TStatusbar and how to fit it
into one of the Statusbar-Panels?

Thank's
0
Comment
Question by:Miucha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 3

Expert Comment

by:LukA_YJK
ID: 8232986
Using standard features. Set the Style to psOwnerDraw and write your drawing code (simple blue colored bar) to the OnDrawPanel event. Then you can use Invalidate or Repaint every time you need to update your ProgressBar. Hope it will help... Do ou need a code?
0
 

Accepted Solution

by:
Spetson earned 300 total points
ID: 8233306
//----->The Code Begin Here
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ComCtrls;

//This is the Normal TForm Class...
//Don't forget to add a ProgressBar and a Status Bar to this Form.
//And also, don't forget to add a least 2 panels to your StatusBar!
type
  TForm1 = class(TForm)
  StatusBar1: TStatusBar;
  ProgressBar1: TProgressBar;
    procedure FormShow(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
end;

//Now, this is a special class
TMyStatusBar = class(TStatusBar)
public
constructor Create(AOwner: TComponent); override;
end;

var
  Form1: TForm1;

implementation
  uses commctrl;

  constructor TMyStatusBar.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  ControlStyle:= ControlStyle + [csAcceptsControls];
end;

{$R *.dfm}
//Form On Show Event

procedure TForm1.FormShow(Sender: TObject);
var r : TRect;
begin


Statusbar1.perform(SB_GETRECT,1,integer( @R ));
//The number 1 above, determine the StatusBar Panel number.
// 0 = first Panel; 1 = the second and so on.


progressbar1.parent := Statusbar1;
progressbar1.top := r.top;
progressbar1.left := r.left;
progressbar1.width := r.right-r.left;
progressbar1.height := r.bottom-r.top;
end;


end.
//----->The Code Ends Here

0
 
LVL 1

Author Comment

by:Miucha
ID: 8233344
Oh! Very Nice...
This worked perfectly in my program!
Thank's!
0
 

Expert Comment

by:kenny_njc
ID: 8319211
I will drop two components in the form (one is status bar and another is progress bar)
Then fit the progress bar with the status bar.
Then bring the progress bar to front of the status bar.

kenny
0
 

Expert Comment

by:Spetson
ID: 8324567
Yes, this will work's to!
But i think that, if you resize your form, or maximize it, maybe u got some problems!
Please correct me here if i'm wrong...

.::Spetson::.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses
Course of the Month14 days, 18 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question