Board index » cppbuilder » How to put a progress bar in a status bar

How to put a progress bar in a status bar

I want to add a progress bar in a status bar. I am writing a communications
program for work that will be called by the parent program. It's very
simple, with a main form that arises that lets you enter the phone number to
dial, a button that takes you to an options form that has various dial
settings, and it simply selects a file to transfer, dials the number and
transfer the file via zmodem. I have 2 panels in my status bar: 1 that has
the dialing/connnecting/transmitting/disconnecting/idle message and the
other I want to have a progress bar that shows the progress of the file in
transmit. I have set up the panel's style property to psOwnerDraw and wrote
the beginnings of an event handler

void __fastcall TForm1::StatusBarDrawPanel(TStatusBar *StatusBar,
TStastusPanel *Panel, const TRect &Rect)
{    
    TCanvas &c = *StatusBar->Canvas;            // reference to the status bar Canvas    
    TRect temp = Rect;                                      // temporary TRect object since parameter is a const

Quote
}

That's as far as I've gotten. I'm trying to work off an example from the book Teach Yourself C++Builder 3 in 21 days, but it only draws a static icon in the panel. A progress bar will have to grow as more of the file is sent. I take it that this function will have to be called everytime an update to the progress bar is made. My assumption  would be to create a static variable to keep track of what has already been drawn and add to it every time.

Also, any suggestions in determining how much of a file has been transmitted to update the progress bar?

I'm new to C++ Builder and GUI programming. Any help in finishing this would be much appreciated.

--
Ruel Smith
Cincinnati, OH

 

Re:How to put a progress bar in a status bar


Apparently, I was barking up the wrong alley with this. It seems that I must
use a progress bar component and set its parent as the status bar. Then
what? I did that, but how do I make it show in the status bar and how do I
update it to make it grow with the current state of the process it's showing
the progress of?

--
Ruel Smith
Cincinnati, OH

CodeWarrior forever...Where's my war paint?

Quote
Ruel Smith <rue...@fuse.net> wrote in message

news:s2jntufmhsq55@corp.supernews.com...

Quote
> I want to add a progress bar in a status bar. I am writing a
communications
> program for work that will be called by the parent program. It's very
> simple, with a main form that arises that lets you enter the phone number
to
> dial, a button that takes you to an options form that has various dial
> settings, and it simply selects a file to transfer, dials the number and
> transfer the file via zmodem. I have 2 panels in my status bar: 1 that has
> the dialing/connnecting/transmitting/disconnecting/idle message and the
> other I want to have a progress bar that shows the progress of the file in
> transmit. I have set up the panel's style property to psOwnerDraw and
wrote
> the beginnings of an event handler

> void __fastcall TForm1::StatusBarDrawPanel(TStatusBar *StatusBar,
> TStastusPanel *Panel, const TRect &Rect)

>     TCanvas &c = *StatusBar->Canvas;            // reference to the status
bar Canvas
>     TRect temp = Rect;                                      // temporary

TRect object since parameter is a const
Quote
> }

> That's as far as I've gotten. I'm trying to work off an example from the

book Teach Yourself C++Builder 3 in 21 days, but it only draws a static icon
in the panel. A progress bar will have to grow as more of the file is sent.
I take it that this function will have to be called everytime an update to
the progress bar is made. My assumption  would be to create a static
variable to keep track of what has already been drawn and add to it every
time.
Quote

> Also, any suggestions in determining how much of a file has been

transmitted to update the progress bar?
Quote

> I'm new to C++ Builder and GUI programming. Any help in finishing this

would be much appreciated.

- Show quoted text -

Quote

> --
> Ruel Smith
> Cincinnati, OH

Other Threads