vegui. selector. class.js

Summary
VegUI element type for VegUISelector
a widget that lets the user select a value by clicking two buttons (left and right) with a label in the middle
extends VegUINode
The items array holds value, name pairs meaning a valid items array would look like this:
Constructor
Clears the Items array and calls update_label
Select either the next (right) or the previous (left) item .Calls VegUINode::onchange
Select an item using its index in the array, calls VegUINode::onchange
Selects the first item with the requested value, calls VegUINode::onchange
Sets the most common Template Properties of the selector
Sets the text of the Label child to the currently selected item name

Constants

VUI_SELECTOR

VegUI element type for VegUISelector

VegUISelector

a widget that lets the user select a value by clicking two buttons (left and right) with a label in the middle

Summary
extends VegUINode
The items array holds value, name pairs meaning a valid items array would look like this:
Constructor
Clears the Items array and calls update_label
Select either the next (right) or the previous (left) item .Calls VegUINode::onchange
Select an item using its index in the array, calls VegUINode::onchange
Selects the first item with the requested value, calls VegUINode::onchange
Sets the most common Template Properties of the selector
Sets the text of the Label child to the currently selected item name

Hierarchy

extends VegUINode

Inherits all functions and methods from VegUINode

VegUINode
|
|
+--> VegUISelector

Child Elements

Btn1VegUIButton, Button to select the next item to the left
Btn2VegUIButton, Button to select the next item to the right
LabelVegUINode, Label to display the selected item

Items Array

The items array holds value, name pairs meaning a valid items array would look like this:

var items = [
[1,'First Item'],
[2,'Second Item']
];

Properties

Object Properties

valuevariable, holds the currently selected value
ItemsArray, holds the items in the form of value, name pairs
idxPtrint, index pointer

Functions

VegUISelector

function VegUISelector(refName,
Parent,
Manager)

Constructor

See Parent Class

VegUINode::VegUINode

flush

this.flush = function()

Clears the Items array and calls update_label

go

this.go = function(dir)

Select either the next (right) or the previous (left) item .Calls VegUINode::onchange

Parameters

int dirdirection for selection, Generic directions

See also

select_idx, select_value

Example

// move the selection to the item on the left
Selector.go(VUI_LEFT);

// move the selection to the item on the right
Selector.go(VUI_RIGHT);

select_idx

this.select_idx = function(idx)

Select an item using its index in the array, calls VegUINode::onchange

Parameters

int idxarray index

See also

select_value, go

Example

// select the third item
Selector.select_idx(2);

select_value

this.select_value = function(value)

Selects the first item with the requested value, calls VegUINode::onchange

Parameters

variable valuethe value to search for

See also

select_idx, go

Example

// select the item with the value 22
Selector.select_value(22);

set_selector

this.set = this.set_selector = function(w,
h,
x,
y)

Sets the most common Template Properties of the selector

Alias

set()

Parameters

int wwidth (pixels)
int hheight (pixels)
int xposition x (pixels)
int yposition y (pixels)

See Parent

VegUINode::set_node

update_label

this.update_label = function()

Sets the text of the Label child to the currently selected item name

a widget that lets the user select a value by clicking two buttons (left and right) with a label in the middle
VegUI element type for VegUISelector
function VegUISelector(refName,
Parent,
Manager)
Constructor
this.flush = function()
Clears the Items array and calls update_label
Array, holds the items in the form of value, name pairs
this.update_label = function()
Sets the text of the Label child to the currently selected item name
this.go = function(dir)
Select either the next (right) or the previous (left) item .Calls VegUINode::onchange
varies from element to element
this.select_idx = function(idx)
Select an item using its index in the array, calls VegUINode::onchange
this.select_value = function(value)
Selects the first item with the requested value, calls VegUINode::onchange
this.set = this.set_selector = function(w,
h,
x,
y)
Sets the most common Template Properties of the selector
The most basic VegUI Element.
function VegUINode(refName,
Parent,
Manager)
this.set = this.set_node = function(nodeType,
w,
h,
x,
y,
pos,
z)
Template Function