vegui. button. class.js

Summary
vegUI element type for VegUIButton
extends VegUINode
These flags are turned on for this element by default
Constructor
Builds the button element
Similar to VegUINode::disable_node only that this method also prohibits the mouse cursor from changing to a pointer when hovering over the button element if the button is disabled
Similar to VegUINode::hevent_node only that this function also handles the focus status of the button, giving it active focus when it is clicked and taking the focus when the mouse button is released again
sets the most common template properties for the button

Constants

VUI_BUTTON

vegUI element type for VegUIButton

VegUIButton

Summary
extends VegUINode
These flags are turned on for this element by default
Constructor
Builds the button element
Similar to VegUINode::disable_node only that this method also prohibits the mouse cursor from changing to a pointer when hovering over the button element if the button is disabled
Similar to VegUINode::hevent_node only that this function also handles the focus status of the button, giving it active focus when it is clicked and taking the focus when the mouse button is released again
sets the most common template properties for the button

Hierachy

extends VegUINode

Inherits properties and functions from: VegUINode

VegUINode
|
+--> VegUIButton

The button widget

Flags

These flags are turned on for this element by default

VUI_HMOUSE_DOWN

Properties

Template Properties

T.captionstring, if set the button will be filled with a textnode
T.captionChildNamestring, if set the child with this name will be used to hold the caption text.  This is useful when you add one or more skin childs to the button

Functions

VegUIButton

function VegUIButton(refName,
Parent,
Manager)

Constructor

Parameters

string refNamename of the element
<VegUIElement Parent>Parent element
VegUIElement ManagerManager element

See also

VegUINode::VegUINode

build_button

this.build = this.build_button = function(toNode)

Builds the button element

Alias

build()

Parameters

<HTMLNode toNode>if submitted the created HTML node will be appended to toNode

Returns

nullon failure
int1 on success

See also

VegUINode::build_node

disable_button

this.disable = this.disable_button = function(b)

Similar to VegUINode::disable_node only that this method also prohibits the mouse cursor from changing to a pointer when hovering over the button element if the button is disabled

Alias

disable()

Parameters

bool bdisable (true) or enable (false)

See also

VegUINode::disable_node

Examples

myButton.disable(true); // events will no longer be captured
myButton.disable(false); // events will be captured again

hevent_button

this.hevent = this.hevent_button = function (eventType,
mEvent)

Similar to VegUINode::hevent_node only that this function also handles the focus status of the button, giving it active focus when it is clicked and taking the focus when the mouse button is released again

private function

Alias

hevent()

Parameters

int eventTypeMouse and keyboard event types
Event mEventjavascript event object

See also

VegUINode::hevent_node

set_button

this.set = this.set_button = function(x,
y,
w,
h,
cssNormal,
cssMDown,
c)

sets the most common template properties for the button

Alias

set()

Parameters

int xposition on the x axis (pixels)
int yposition on the y axis (pixels)
int wwidth (pixels)
int hheight (pixels)
string cssNormalcss class to be used when button is not clicked
string cssMDowncss class to be used when button is clicked
string ccaption

See also

VegUINode::set_node

Example

// will set up the button to be positioned at 5, 5 with the size
// of 75x18. When the button is in a normal state the css
// class 'button_normal' will be used, when the button is
// being clicked the css class 'button_click' will be used

myButton.set(5, 5, 75, 18, 'button_normal', 'button_click');
vegUI element type for VegUIButton
function VegUIButton(refName,
Parent,
Manager)
Constructor
this.build = this.build_button = function(toNode)
Builds the button element
this.disable = this.disable_button = function(b)
Similar to VegUINode::disable_node only that this method also prohibits the mouse cursor from changing to a pointer when hovering over the button element if the button is disabled
this.disable = this.disable_node = function(b)
Toggles the VUI_DISABLED flag on this element
this.hevent = this.hevent_button = function (eventType,
mEvent)
Similar to VegUINode::hevent_node only that this function also handles the focus status of the button, giving it active focus when it is clicked and taking the focus when the mouse button is released again
this.hevent = this.hevent_node = function(eventType,
mEvent)
private function
this.set = this.set_button = function(x,
y,
w,
h,
cssNormal,
cssMDown,
c)
sets the most common template properties for the button
The most basic VegUI Element.
enable event handling for VUI_MOUSE_DOWN
function VegUINode(refName,
Parent,
Manager)
this.build = this.build_node = function(toNode,
takeNode)
build a HTML node from the template properties of this element.
Mouse and keyboard eventtypes that help you identify what event you’re dealing with
this.set = this.set_node = function(nodeType,
w,
h,
x,
y,
pos,
z)
Template Function