Nokia N97 SDK Example Applications Guide |
Progress Bar Control Example
1. About this Example
2. Architecture
3. Design and Implementation
This tutorial explains how to use progress bars. Progress bars show the progress status of an operation.
The example application can do the following:
- Increase the progress bar gauge value incrementally.
- Change progress bar final value.
- Display progress bar information.
The following are examples of progress bars:
- Download status
- Mail receiving status
- Loading status
The following figure (UML diagram) shows key classes of the progress bar example application. This example uses the Timer
class object to generate events. This should be replaced by the classes that issue events in actual applications.
Note: The class indicated by a yellow color is the concrete class of the progress bar.
The example makes use of the standard Symbian OS application framework comprising the Application, Document, UI, and View
classes. The reader should be aware of this architecture before attempting to understand this example.
The initial view is shown immediately after the example application is launched. The bar as a whole shows total operation,
and it is filled from left to right according to the progress status of the operation.
Initial view:
The Options menu displays four choices, Change final values, Show info 1, Show info 2 and Exit.
The Options menu:
- Select Change final values to change the number of blocks of the progress bars.
- Select Show info 1 or Show info 2 to get information of certain progress bar. When selecting one or the other of these menu
items, the information note is displayed and progress bar information is listed on it. Information contains following data:
Text type, Split width between blocks, Number of the blocks, Width, Height, Current value.
- Select Exit at any time to exit the application.
Select Show info 1 from the Options menu.
The example makes use of the standard Symbian OS application framework comprising the Application, Document, UI, and View
classes. The reader should be aware of this architecture before attempting to understand this example.
PROGRESSINFO, defined in "eikon.rh" , contains all settings that can be used in the resource file. Following example illustrates
how to use PROGRESSINFO resource:
RESOURCE PROGRESSINFO r_my_progress_bar
{
text_type = 0;
splits_in_block = 0;
finalval = 15;
width = 120;
height = 10;
}
Explanations of PROGRESSINFO resource initializers:
| text_type |
Text type to display. (0: none, 1: percentage, 2:fraction) |
| splits_in_block |
Gap between the blocks |
| finalval |
Total number of blocks |
| width |
Width of the progress bar [in pixel] |
| height |
Height of the progress bar [in pixel] |
The progress bar can be constructed according to two methods:
- with the resource file
- without the resource file
The following figure shows how to construct the progress bar with the resource file. The function ConstructFromResourceL is
called according to the resource data. Next, the progress bar is constructed.
The following figure shows how to construct the progress bar without the resource file. Whether or not there is a resource
file, CEikProgressInfo::SInfo must be defined and passed to the constructor as a parameter. The second constructor must be
called ConstructL.
The function IncrementAndDraw steps the current position of the progress bar forward or backward along the bar.
The gauge value changes depend on the parameter value. For example, when 1 is set to the parameter, the gauge value increases
1 and when -1 is set to the parameter, the gauge value decreases 1. To move the gauge to the target position, use SetAndDraw
function. For example, when the function SetAndDraw is invoked with the "0" parameter, the progress bar gauge is reset.
In this example the final value of progress bar could be changed. The final value is realised by calling IncrementAndDraw
with parameter 1 from the CAknExPbarTimer::RunL.
The application does not require any capabilities. The program capabilities are defined in mmp-files as CAPABILITY NONE.
|
© Nokia 2009
|

|