Core Function GUICreateComboBox

From Sputnik Wiki
Revision as of 08:23, 4 March 2012 by UberFoX (Talk | contribs)
Jump to: navigation, search
GUICreate( "ComboBox", <gui object>, <Left>, <Top>, <Width>, <Height> )

Contents

Description

Create a ComboBox

Parameters

gui object

The GUI object to place the ComboBox 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

This is very basic example it has 2 keys for testing stuff

// Create the GUI
$GUI = GUICreate("Window", "Hello", 350, 350);
// Show the GUI
GUILoad( $GUI );
// Create a ComboBox
$Combo = GUICreate("ComboBox", $GUI, 8, 8);
 
HotKeySet("{F1}", "SetItems();");
HotKeySet("{F2}", "Check();");
 
// Keep the GUI running as long as long as the window is open
While ( GUIStatus( $GUI ) ) DoEvents( );
 
Function Check()
{
	$SelIndex = GUIComboBox( $Combo, "SelectedIndex" );
	println("Currently selected index '$SelIndex'");
	$SelItem = GUIComboBox( $Combo, "SelectedItem" );
	println("Currently selected item '$SelItem'");
	$SelText = GUIComboBox( $Combo, "SelectedText" );
	println("Currently selected text '$SelText'");
	$SelLength = GUIComboBox( $Combo, "SelectionLength" );
	println("Currently selected text length '$SelLength'");
	$SelStart = GUIComboBox( $Combo, "SelectionStart" );
	println("Currently selected text start '$SelStart'");
 
	GUIComboBox( $Combo, "DroppedDown", 1 );
}
 
Function SetItems()
{
	GUIComboBox( $Combo, "SetItems", array(100, 200, 300, 400) );
	GUIComboBox( $Combo, "AddItems", array(500, 600, 700, "Hello") );
	GUIComboBox( $Combo, "InsertItems", array("One", "Two", "Three"), 3 );
 
	$Items = GUIComboBox( $Combo, "GetItems" );
	foreach($Items as $i)
	{
		println("Item '$i'");
	}
}
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox