This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Basics
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Animations-Related Classes
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
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine.WidgetSpinBox Class

Inherits from: Widget

This class creates a spin box.

The object of this class looks as follows:

See Also#

Usage Example#

This example illustrates creation of a spinbox via code.

Source code (C#)
using System.Collections;
using System.Collections.Generic;
using Unigine;

[Component(PropertyGuid = "AUTOGENERATED_GUID")] // <-- this line is generated automatically for a new component
public class ComponentName : Component
{
	 // declaring a spinbox
		WidgetSpinBox spinbox;

		// implement the Changed event handler to be fired on changing spinbox value
		void onSpinboxChanged(Widget widget)
		{
			// printing the current spinbox value to the console and 
			Log.Message("Spinbox value changed: {0} \n", (widget as WidgetSpinBox).Value);
			(widget as WidgetSpinBox).SetFocus();
		}

	// Method creating a spinbox with specified parameters at the specified position
	WidgetSpinBox CreateSB(int x, int y, int min, int max, int value, int step)
	{
		// get a pointer to the system GUI
		Gui gui = Gui.GetCurrent();
		// creating a new edit line and adding it to the GUI
		WidgetEditLine new_el = new WidgetEditLine(gui);
		gui.AddChild(new_el, Gui.ALIGN_OVERLAP);
		// setting widget's position
		new_el.SetPosition(x, y);

		// creating a spinbox with the specified parameters and adding it to the GUI
		WidgetSpinBox new_sb = new WidgetSpinBox(gui, min, max, value, step);
		gui.AddChild(new_sb, Gui.ALIGN_OVERLAP);

		// adding a callback to be fired on changing spinbox value
		new_sb.EventChanged.Connect(onSpinboxChanged);
		new_sb.Order = 1;

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

		// setting initial spinbox value
		new_sb.Value = value;

		return new_sb;
	}

	void Init()
	{
		  // creating a spinbox with values in [0, 10] range (current - 5) at position (100, 100)
			spinbox = CreateSB(100, 100, 0, 10, 5, 1);
		
	}
}

WidgetSpinBox Class

Properties

int Value#

The current value of the spinbox.

int MaxExpand#

The current maximum value, up to which the upper limit of the range of the spinbox values can be expanded. 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.

int MinExpand#

The current minimum value, up to which the lower limit of the range of the spinbox values can be expanded. 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.

int MaxValue#

The maximum value of the spinbox.

int MinValue#

The minimum value of the spinbox.

vec4 ButtonColor#

The current color for the widget's button..

int Step#

The current step of the spinbox.

Members


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

Constructor. Creates a spinbox with given parameters and adds it to the specified GUI.

Arguments

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

WidgetSpinBox ( int min = 0, int max = 100, int value = 0, int step = 1 ) #

Constructor. Creates a spinbox with given parameters and adds it to the Engine GUI.

Arguments

  • int min - Minimum value.
  • int max - Maximum value.
  • int value - Initial value.
  • int step - Initial step.
Last update: 2024-12-13
Build: ()