Progress Bar controls
Published 07 JUN 2013 at 02:27:10PM
One of the new controls supported by OpenInsight 10 is the Windows Progress Bar control which is used to display the progress of lengthy operations.
[caption id="attachment_803" align="aligncenter" width="247"] Windows 7 Aero Progress Bar[/caption]
[caption id="attachment_901" align="aligncenter" width="238"] Windows XP Progress Bar[/caption]
It is a fairly simple control and supports the following properties:
- BORDER
- ERRORCOLOR
- MARQUEE
- NORMALCOLOR
- PAUSEDCOLOR
- RANGE
- SHOWTEXT
- SMOOTH
- STATE
- STEP
- SYNCTASKBAR
- TEXT
- TRANSLUCENCY
- VALUE
- VERTICAL
And the following methods:
- DECREMENT
- INCREMENT
BORDER property
Setting this boolean property to TRUE ("1") draws a border around the control. This is the default value.
[caption id="attachment_902" align="aligncenter" width="238"] Translucent XP Progress Bar without a border[/caption]
ERRORCOLOR property
This property is a standard color value and sets the color of the bar when it is in the "error" state (see the STATE property below). Depending on the visual style in use this property normally defaults to a red color.
[caption id="attachment_807" align="aligncenter" width="239"] Windows Classic smooth style Progress Bar with an ERRORCOLOR of 255 (red)[/caption]
MARQUEE property
This property is an integer value that contains the time in milliseconds between marquee animation updates. Setting it to 0 stops the marquee animation.
[caption id="attachment_804" align="aligncenter" width="247"] Aero Progress Bar with a MARQUEE property of 50 (i.e. it animates every 50 ms)[/caption]
[caption id="attachment_903" align="aligncenter" width="238"] Windows XP Progress Bar with a MARQUEE property of 50[/caption]
NORMALCOLOR property
This property is a standard color value and sets the color of the bar when it is in the "normal" state (see the STATE property below). Depending on the visual style in use this property normally defaults to a green color, though in other schemes like "XP Olive" this defaults to an orange color instead.
[caption id="attachment_912" align="aligncenter" width="254"] Windows 7 Aero progress Bar with a purple NORMALCOLOR (255,0,255)[/caption]
PAUSEDCOLOR property
This property is a standard color value and sets the color of the bar when it is in the "paused" state (see the STATE property below). Depending on the visual style in use this property normally defaults to an amber or yellow color.
[caption id="attachment_906" align="aligncenter" width="254"] Windows 7 Aero segmented Progress Bar with a STATE of "3" (paused)[/caption]
RANGE property
This property is an @fm-delimited array of two integers containing the upper and lower limits of the progress bar.
<1> Low limit <2> High Limit
The VALUE property must be between these two values.
SHOWTEXT property
Setting this property to TRUE ("1") will display the contents of the TEXT property in the center of the progress bar. The default is FALSE ( "0").
SMOOTH property
Setting this property to TRUE ("1") causes the progress indicator to be drawn as a continuous bar rather than in the usual segmented style.
[caption id="attachment_806" align="aligncenter" width="239"] Windows Classic Smooth Progress Bar - i.e. a SMOOTH style of TRUE ("1")[/caption]
[caption id="attachment_910" align="aligncenter" width="254"] Windows 7 Aero segmented Progress Bar - i.e. a SMOOTH style of FALSE ("0")[/caption]
STATE property
This property sets the visual state of the progress bar. It can be one of the following values:
- "1" - Normal (green)
- "2" - Error (red)
- "3" - Paused (yellow)
Each of these states has a default color as indicated above but this can be changed by one of the bar color properties (NORMALCOLOR, ERRORCOLOR and PAUSEDCOLOR).
Examples:
[caption id="attachment_808" align="aligncenter" width="247"] Windows 7 Aero Progress bar with a STATE property of 2[/caption]
[caption id="attachment_809" align="aligncenter" width="247"] Windows 7 Aero Progress bar with a STATE property of 3[/caption]
STEP property
This property is a simple integer and is used in conjunction with the INCREMENT method. If the latter is called with no value the progress bar is incremented by the amount specified in this property.
SYNCTASKBAR property
When set to TRUE ("1") the parent form's taskbar button is automatically updated to mirror the state of the Progress Bar control (as per our previous post on Taskbar Integration).
[caption id="attachment_812" align="aligncenter" width="268"] Windows 7 Aero Progress Bar with SYNCTASKBAR set to TRUE ("1")[/caption]
This property has no effect unless the application is running on Windows 7 or higher.
TEXT property
This property is the same as the standard TEXT property. However, any occurrences of the substring "%p%" within the text will be replaced with the current percentage complete.
[caption id="attachment_899" align="aligncenter" width="254"] Windows 7 Aero Progress Bar with a TEXT property of "%p% Complete"[/caption]
TRANSLUCENCY property
This property specifies the transparency of the control's background (i.e. the progress bar itself is not affected). It is based on simple percentage amount, “0″ being fully opaque and “100″ being fully transparent (and therefore not visible).
[caption id="attachment_898" align="aligncenter" width="254"] Windows 7 Aero Progress Bar with a TRANSLUCENCY of 50[/caption]
VALUE property
This simple integer property sets the current value (position) of the progress bar. It should be a value between the limits set by the RANGE property.
[caption id="attachment_814" align="aligncenter" width="247"] Windows 7 Aero Progress Bar with a RANGE of [0,200] and a VALUE of 50[/caption]
VERTICAL property
Setting this property to TRUE ("1") draws the progress bar in a vertical fashion - i.e. it increments from the bottom to the top.
[caption id="attachment_815" align="aligncenter" width="236"] Windows 7 Aero Progress Bar with a VERTICAL property of TRUE ("1")[/caption]
DECREMENT method
exec_Method( ctrlEntID, "DECREMENT", amount )
This method decrements the progress bar by a specified amount. If no amount is specified the bar is decremented by the value contained in the STEP property instead.
INCREMENT method
exec_Method( ctrlEntID, "INCREMENT", amount )
This method increments the progress bar by a specified amount. If no amount is specified the bar is incremented by the value contained in the STEP property instead.
Further reading
More information on Progress Bars can be found on the MSDN site here, along with some user interface guidelines here.
(Disclaimer: This article is based on preliminary information and may be subject to change in the final release version of OpenInsight 10).