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.

WidgetSpinBox Class

Warning
UnigineScript is deprecated and will be removed in future releases. Please consider using C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt is not guaranteed, as the current level of support assumes only fixing critical issues.
Inherits: Widget

This class creates a spin box.

Usage Example#

This example illustrates creation of a spinbox via code.

Source code (UnigineScript)
// declaring editline and spinbox widgets
WidgetEditLine new_el;
WidgetSpinBox new_sb;

// callback to be fired on changing spinbox value
void sbChanged(WidgetSpinBox sb) {
	// printing the current spinbox value to the console 
	log.message("Spinbox value changed: %d \n", sb.getValue());
	sb.setFocus();
}

int init() {
	// Write here code to be called on world initialization: initialize resources for your world scene during the world start.

	// ...
	
	// getting the GUI 
	Gui gui = engine.getGui();
	
    // creating a new edit line and adding it to the GUI
	new_el = new WidgetEditLine(gui);
    gui.addChild(new_el, GUI_ALIGN_OVERLAP);
    
	// setting widget's position
    new_el.setPosition(100, 100);

    // creating a spinbox with the specified min and max values and adding it to the GUI
    new_sb = new WidgetSpinBox(gui, 0, 10);
    gui.addChild(new_sb, GUI_ALIGN_OVERLAP);
       
    // adding a callback to be fired on changing spinbox value
    new_sb.setCallback(GUI_CHANGED, functionid(sbChanged), new_sb);
    new_sb.setOrder(1);

    // attaching the spinbox to the edit line
    new_el.addAttach(new_sb);

    // setting initial spinbox value to 5
    new_sb.setValue(5);
	
	return 1;
}

// ...

WidgetSpinBox Class

Members


static WidgetSpinBox ( Gui gui, int min = 0, int max = 100, int value = 0 ) #

Constructor. Creates a spinbox with given parameters.

Arguments

  • Gui gui - GUI, to which the spinbox will belong.
  • int min - Minimum value.
  • int max - Maximum value.
  • int value - Initial value.

void setMaxExpand ( int expand ) #

Sets the maximum value, up to which the upper limit of the range of the spinbox values can be expanded.

Arguments

  • int expand - Maximum value, up to which the spinbox upper limit can be raised.

int getMaxExpand ( ) #

Returns the current maximum value, up to which the upper limit of the range of the spinbox values can be expanded.
Notice
The upper limit of the spinbox can be expanded only if the spinbox is attached to an editline with the GUI_ATTACH_MAX_EXPAND flag.
See also the setMaxExpand() function.

Return value

Maximum value, up to which the spinbox upper limit can be raised.

void setMaxValue ( int value ) #

Sets a maximum value of the spinbox.

Arguments

  • int value - Maximum value.

int getMaxValue ( ) #

Returns a maximum value of the spinbox.
Notice
The value returned by this function may differ from the value set via setMaxValue(). See The setMaxExpand() function for more details.

Return value

Maximum value.

void setMinExpand ( int expand ) #

Sets the minimum value, up to which the lower limit of the range of the spinbox values can be expanded.

Arguments

  • int expand - Minimum value, up to which the spinbox lower limit can be dropped.

int getMinExpand ( ) #

Returns the current minimum value, up to which the lower limit of the range of the spinbox values can be dropped.
Notice
The lower limit of the spinbox can be expanded only if the spinbox is attached to an editline with the GUI_ATTACH_MIN_EXPAND flag.
See also the setMinExpand() function.

Return value

Minimum value, up to which the spinbox lower limit can be dropped.

void setMinValue ( int value ) #

Sets a minimum value of the spinbox.

Arguments

  • int value - Minimum value.

int getMinValue ( ) #

Returns a minimum value of the spinbox.
Notice
The value returned by this function may differ from the value set via setMinValue(). See The setMinExpand() function for more details.

Return value

Minimum value

void setValue ( int value ) #

Updates a current value of the spinbox.

Arguments

  • int value - New value.

int getValue ( ) #

Returns a current value of the spinbox.

Return value

Current value.

void setButtonColor ( vec4 color ) #

Sets the color for the widget's button.

Arguments

  • vec4 color - Four-component vector specifying the color in the RGBA format.

vec4 getButtonColor ( ) #

Returns the current color for the widget's button.

Return value

Four-component vector specifying the color in the RGBA format.
Last update: 2020-04-10
Build: ()