This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.WidgetButton Class

Inherits: Widget

Interface for widget button handling.

See Also#

  • UnigineScript API sample <UnigineSDK>/data/samples/widgets/button_00

Example#

The following code illustrates how to create a button widget and set its parameters.

Source code (C#)
/* .. */

// event handler function
void OnButtonClicked()
{
	/* .. */
	
	return;
}

/* .. */
 public override bool Init()
{
	// getting a pointer to the system GUI
	Gui gui = Gui.Get();

	// creating a button widget and setting its caption
	WidgetButton widget_button = new WidgetButton(gui, "Delete");

	// setting a tooltip
	widget_button.SetToolTip("Delete object(s)");

	// rearranging button size
	widget_button.Arrange();

	// setting button position
	widget_button.SetPosition(10, 10);

	// setting onButtonClicked function to handle CLICKED event
	widget_button.AddCallback(Gui.CALLBACK_INDEX.CLICKED, OnButtonClicked);

	// adding created button widget to the system GUI
	gui.AddChild(widget_button, Gui.ALIGN_OVERLAP | Gui.ALIGN_FIXED);
}

WidgetButton Class

Properties

string Text#

The button text label.
set
Sets a button text label.
set value - Button label.

int TextAlign#

Alignment of the button label.
set
Sets alignment of the button label.
set value - One of the GUI_ALIGN_* pre-defined variables.

string Texture#

The path to the button image texture.
set
Sets a button image texture.
set value - Path to a texture file.

bool IsToggled#

A value indicating if the toggle button is pressed.
set
Sets a state of the toggle button.
set value - Positive number to press the button, 0 to release it.

bool IsToggleable#

A value indicating if the button is a toggle button or a simple one. the default is 0.
set
Sets a value indicating if the button is a toggle button or a simple one.
set value - Positive number to make the button a toggle button, 0 to make it a simple one.

int Background#

A value indicating if a background texture is rendered for the button. the default is 1.
set
Sets a value indicating if a background texture should be rendered for the button. By default, the background texture is always rendered. The default is 1.
set value - Positive number to render a background texture, 0 not to render.

vec4 ButtonColor#

Returns the current color for the button.
set
Sets the color to be used for the button.
set value - Four-component vector specifying the color in the RGBA format.

Members


static WidgetButton ( Gui gui, string str = 0 ) #

Constructor. Creates a button with a given label and adds it to the specified GUI.

Arguments

  • Gui gui - GUI, to which the new button will belong.
  • string str - Button label. This is an optional parameter.

static WidgetButton ( string str = 0 ) #

Constructor. Creates a button with a given label and adds it to the Engine GUI.

Arguments

  • string str - Button label. This is an optional parameter.

void SetImage ( Image image ) #

Updates a button image.

Arguments

  • Image image - Image to set.

Image GetImage ( ) #

Returns the button image.

Return value

Button image.
Last update: 2020-07-31
Build: ()