Core Function GUICreateListBox

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

Contents

Description

Create a ListBox

Parameters

gui object

The GUI object to place the ListBox on.

text

The text the button should display.

left

LEFT Position to create the object.

top

TOP Position to create the object.

width

Optional; The width of the object.

height

Optional; The height of the object.

Return Value

Success: Returns the new GUI object.

Failure: Returns 0 if error occurs.

Example

// Create the GUI
Global $GUI = GUICreate("Window", "Hello", 550, 350);
// Show the GUI
GUILoad( $GUI );
// Create a ComboBox
Global $ListBox = GUICreate("ListBox", $GUI, 8, 8, 300, 300);
 
// Do some stuff
GUIListBox( $ListBox, "SetItems", array(100, 200, 300, 400) );
GUIListBox( $ListBox, "AddItem", 450 );
GUIListBox( $ListBox, "AddItems", array(500, 600, 700, "Hello") );
GUIListBox( $ListBox, "InsertItem", "lol", 3 );
GUIListBox( $ListBox, "InsertItems", array("One", "Two", "Three", "Four"), 4 );
GUIListBox( $ListBox, "DelItem", "Three" );
GUIListBox( $ListBox, "DelItemAt", 0 );
$Items = GUIListBox( $ListBox, "GetItems" );
foreach($Items as $i)
{
	println("Item '$i'");
}
 
// Add Links
GUILink($ListBox, 'SelectedIndexChanged', 'onChange($arg);');
 
 
// Keep the GUI running as long as long as the window is open
While ( GUIStatus( $GUI ) ) DoEvents( );
 
Function onChange( $arg )
{
	my $Index = $arg[0];
	my $Text = $arg[1];
	println("ListBox was clicked... Index '$Index' | Text '$Text'");
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox