fPROGRESS


Quick Data

Header file:progress.h
Object name:fPROGRESS
Object index:1 of 1 Object

General Description

The fPROGRESS is a class which displays a progress bar, which can be used to display the current progress of a particular job. The progress bar is pretty basic, and doesn't do a whole lot.

This component is derived from _GUIBASE, and inherits the properties from that.


Primary Options


Name Description Value

There are no Primary properties for this component. Just use pbNormal or 0 (Zero).

Secondary Options


Name Description Value

pbUsual This style makes the progress bar look like this: Progress Bar normal look. You should always use this style, and then, if you want, combine it with the other styles that you want. AvWind
pbSmooth This style makes the progress bar look like this: Progress Bar Smooth style. You should combine this with pbUsual if you want a smooth progress bar. PBS_SMOOTH
pbVertical This style makes the progress bar work vertically instead of horizontally. You should combine this with pbUsual if you want a vertical progressbar. PBS_VERTICAL

Methods


Prototype Description

void SetBarColour(COLORREF Colour); This function sets the colour of the bar.
void SetBackgroundColour(COLORREF Colour); This function sets the background colour of the progress bar.
void SetRange(int Min, int Max); This function sets the range of the progress bar. By setting this, you allow the progress bar to automatically calculate by itself the proportion of the bar. Say that you are reading a file, byte by byte. Use this function and set the range from 0 (Zero) to the number of bytes to be read. Then you can simply add one each time you read a byte, rather than having to manually calculate a percentage or anything funny like that. The default range is from 0 (Zero) to 100.
void SetPos(int Position); This function sets the position of the progress bar. By 'position', I mean how big the bar is inside the progress bar. Setting this to 50 under the default range settings will make half of the progress bar be hilighted.
void SetStep(int Step); There is an extra feature built into progress bars, known as stepping. By setting this step, you can simply call the Step() function (documented below) to add the step to the current position of the progress bar. It saves some mathematics on your part. The step, which you set with this function, is the amount to increase the progress bar's value by each time you call Step().
void Step(void); This function adds a predetermined number to the progress bars position - without you needing to do any mathematics for it. You can set this step by using the SetStep() function, which is documented above.

Sample Code

The following snippet gives a basic idea of how to use this component.


//Create a progress bar.
fPROGRESS ProgBar;
ProgBar.CreateWin(Window.GetHandle(), "Caption", PROGRESS_BAR_ID, pbNormal, pbUsual);

//Now set the range.
ProgBar.SetRange(0, 200);

//Just fill it up, one bit at a time.
for (int Temp = 0; Temp < 201; Temp++)
    {
    ProgBar.SetPos(Temp);
    }

//Now reset the bar...
ProgBar.SetPos(0);

//Set up the step value.
ProgBar.SetStep(10); //Add 10 each time Step() is called.

//Now add 40 to the progress bar.
ProgBar.Step();
ProgBar.Step();
ProgBar.Step();
ProgBar.Step();

Back to indexThe FreeFoote Foundation Classes Documentation