Core Function GUICreateTimer

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
m (1 revision)
m (1 revision)
 

Latest revision as of 12:37, 14 June 2015

GUICreate( "Timer", <gui object>, <Interval> )

Contents

Description

Create a Timer

Parameters

gui object

The GUI object to place the button on.

interval

How many miliseconds between the timer link execute.

Return Value

Success: Returns the new GUI object.

Failure: Returns 0 if error occurs.

Remarks

The timer will execute its code totally independent of all other code (Same as every other Link code)

Example

// Create the GUI
$GUI = GUICreate("Window", "Hello", 200, 200);
// Show the GUI
GUILoad( $GUI );
// Create a Timer
$Timer = GUICreate("Timer", $GUI, 100);
// Create a button
$Button = GUICreate("Button", $GUI, 8, 8);
// Link timer to a function
GUILink($Timer, "Tick", 'TimerTicky($me);');
// Link button to a function
GUILink($Button, "Click", 'ButtonClicky($me);');
// Start the timer
GUITimer($Timer, "Start");
 
// Keep the GUI running as long as long as the window is open
While ( GUIStatus( $GUI ) ) DoEvents( );
 
Function TimerTicky( $me )
{
	println("Ticky is: " . $me);
}
 
Function ButtonClicky( $me )
{
	// Toggle the timer on/off
	if(GUITimer($Timer, "Status"))
	{
		GUITimer($Timer, "Stop");
		println("Timer Stopped");
	}
	else
	{
		GUITimer($Timer, "Start");
		println("Timer Started");
	}
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox