This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and 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
CIGI Client 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.WidgetSpinBox Class

Inherits: Widget

This class creates a spin box.

Usage Example#

This example illustrates creation of a spinbox via code.

Source code (C#)
// AppWorldLogic.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Unigine;

namespace UnigineApp
{
	class AppWorldLogic : WorldLogic
	{
        // declaring a spinbox
        WidgetSpinBox spinbox;

        // callback to be fired on changing spinbox value
        void sbChanged(Widget widget) {
			WidgetSpinBox sb = WidgetSpinBox.cast(widget);

			// printing the current spinbox value to the console and 
			Log.message("Spinbox value changed: {0} \n", sb.getValue());
			sb.setFocus();
		}

    // Method creating a spinbox with specified parameters at the specified position
    WidgetSpinBox createSB(int x, int y, int min, int max, int value)
    {
        // creating a new edit line and adding it to the GUI
        WidgetEditLine new_el = new WidgetEditLine(Gui.get());
        Gui.get().addChild(new_el.getWidget(), Gui.ALIGN_OVERLAP);
        new_el.release();
        // 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.get(), min, max);
        Gui.get().addChild(new_sb.getWidget(), Gui.ALIGN_OVERLAP);
        new_sb.release();

        // adding a callback to be fired on changing spinbox value
        new_sb.addCallback(Gui.CHANGED, sbChanged);
        new_sb.setOrder(1);

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

        // setting initial spinbox value
        new_sb.setValue(value);

        return new_sb;
    }
    public AppWorldLogic()
		{
		}

		public override int init()
		{
            // creating a spinbox with values in [0, 10] range (current - 5) at position (100, 100)
            spinbox = createSB(100, 100, 0, 10, 5);

            return 1;
		}
		
		// ...
	}
}

WidgetSpinBox Class

Properties

int Value#

The current value of the spinbox.
set
Updates the current value of the spinbox.
set value - New value.

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

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

int MaxValue#

A maximum value of the spinbox.
set
Sets a maximum value of the spinbox.
set value - Maximum value.

int MinValue#

A minimum value of the spinbox.
set
Sets a minimum value of the spinbox.
set value - Minimum value.

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.

WidgetSpinBox Cast ( Widget widget ) #

Casts a WidgetSpinBox out of the Widget instance.

Arguments

  • Widget widget - Widget instance.

Return value

WidgetSpinBox instance.

int type ( ) #

WidgetSpinBox type.

Return value

WidgetSpinBox type identifier.
Last update: 2019-08-16
Build: ()