Core Function GUICreateProgressBar

From Sputnik Wiki
Jump to: navigation, search
GUICreate( "ProgressBar", <gui object>, <Left>, <Top>, <Width>, <Height> )

Contents

Description

Create a ProgressBar

Parameters

gui object

The GUI object to place the ProgressBar on.

Return Value

Success: Returns the new GUI object.

Failure: Returns 0 if error occurs.

Remarks

The progress bar will do nothing unless you change its "Value" ie progress.

Example

// Create the GUI
$GUI = GUICreate("Window", "GUI", 200, 200);
// Show the GUI
GUILoad( $GUI );
// Create a progress bar
$PBar = GUICreate("ProgressBar", $GUI, 8, 8);
// Create a timer to update the progress bar
$Timer = GUICreate("Timer", $GUI, 200);
GUILink($Timer, "Tick", 'TimerTicky($me);');
GUITimer($Timer, "Start");
// Alternatively change the ProgressBar style uncomment one to see the effect
//GUIProgressBar($PBar, "Style", "Continuous");
//GUIProgressBar($PBar, "Style", "Blocks");
//GUIProgressBar($PBar, "Style", "Marquee");
 
// Keep the GUI running as long as long as the window is open
While ( GUIStatus( $GUI ) ) DoEvents( );
 
Function TimerTicky( $me )
{
	my $Progress = GUIGetProp($PBar, "Value");
	if($Progress >= 100)
	{
		$Progress = 0;
	}
	else
	{
		$Progress += 10;
	}
	GUISetProp($PBar, "Value", $Progress);
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox