This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
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

This class creates a spin box.

WidgetSpinBox Class

This class inherits from Widget

Members


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.

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.

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.

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.

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

int getValue ()

Returns a current value of the spinbox.

Return value

Current value.

void setMaxExpand (int value)

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

Arguments

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

Examples

The following example demonstrates how to make the spinbox expandable and to set the maximum value, up to which the upper limit of the spinbox can be raised:

Source code (UnigineScript)
// get a system GUI
Gui gui = engine.getGui();

// create a new window and add it to the gui
WidgetWindow window = new WidgetWindow(gui,"Window",20,20);
gui.addChild(window,GUI_ALIGN_CENTER);

// add a new editline to the gui
WidgetEditLine editline = new WidgetEditLine(gui,"15");
window.addChild(editline,GUI_ALIGN_LEFT);

// add a new spinbox to the gui and attach it to the editline
WidgetSpinBox spinbox = new WidgetSpinBox(gui,8,20,15);
window.addChild(spinbox,GUI_ALIGN_OVERLAP);
editline.addAttach(spinbox,0,1,GUI_ATTACH_MAX_EXPAND);
// set the maximum expand value for the spinbox
spinbox.setMaxExpand(3);
						

In the result, the following window will be created:

The maximum spinbox value is 20 by default.

If you type, for example, 26 in the editline, the upper limit of the spinbox will be raised:

The maximum spinbox value is equal to 26 now.

void setMaxValue (int max)

Sets a maximum value of the spinbox.

Arguments

  • int max - Maximum value.

void setMinExpand (int value)

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

Arguments

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

Examples

The following example demonstrates how to make the spinbox expandable and to set the minimum value, up to which the lower limit of the spinbox can be dropped:

Source code (UnigineScript)
// get a system GUI
Gui gui = engine.getGui();

// create a new window and add it to the gui
WidgetWindow window = new WidgetWindow(gui,"Window",20,20);
gui.addChild(window,GUI_ALIGN_CENTER);

// add a new editline to the gui
WidgetEditLine editline = new WidgetEditLine(gui,"15");
window.addChild(editline,GUI_ALIGN_LEFT);

// add a new spinbox to the gui and attach it to the editline
WidgetSpinBox spinbox = new WidgetSpinBox(gui,8,20,15);
window.addChild(spinbox,GUI_ALIGN_OVERLAP);
editline.addAttach(spinbox,0,1,GUI_ATTACH_MIN_EXPAND);
// set the minimum expand value for the spinbox
spinbox.setMinExpand(3);
						

In the result, the following window will be created:

The minimum spinbox value is 8 by default.

If you type, for example, 3 in the editline, the lower limit of the spinbox will be decreased:

The minimum spinbox value is equal to 3 now.

void setMinValue (int min)

Sets a minimum value of the spinbox.

Arguments

  • int min - Minimum value.

void setValue (int value)

Updates a current value of the spinbox.

Arguments

  • int value - New value.
Last update: 2017-07-03
Build: ()