class haxe.ui.toolkit.controls.Button extends StateComponent

Available on all platforms

General purpose multi-state button control with icon and toggle support (plus icon positioning)

Code Example

 var button:Button = new Button();
 button.x = 100;
 button.y = 100;
 button.width = 150;
 button.height = 100;
 button.text = "Button"; = "theButton";

XML Example

 <button id="theButton" text="Button" x="100" y="100" width="150" height="100" />

Class Fields

static var STATE_DISABLED:String

Button state is "disabled"

static var STATE_DOWN:String

Button state is "down"

static var STATE_NORMAL:String

Button state is "normal" (default state)

static var STATE_OVER:String

Button state is "over"

Instance Fields

Show inherited public instance fieldsHide inherited public instance fields

Inherited from StateComponent

var state:String
var states:Array<String>
function addState(stateName:String, ?rebuildStyles:Bool):Void
function addStates(stateNames:Array<String>, ?rebuildStyles:Bool):Void
function clone():StateComponent
function hasState(state:String):Bool

Inherited from Component

var clipContent:Bool
var clipHeight:Float
var clipWidth:Float
var disabled:Bool
var namedComponents:Array<IComponent>
var scriptletSource:String
var text:String
var userData:Dynamic
var value:Dynamic
function addEventListener(type:String, listener:Dynamic ->Void?useCapture:Bool, ?priority:Int, ?useWeakReference:Bool):Void
function addScriptlet(scriptlet:String):Void
function addScriptletEventHandler(event:String, scriptlet:String):Void
function clearClip():Void
function clone():Component
function executeScriptletExpr(expr:String):Void
function invalidate(?type:Int, ?recursive:Bool):Void
function removeEventListener(type:String, listener:Dynamic ->Void?useCapture:Bool):Void

Inherited from StyleableDisplayObject

var baseStyle:Style
var style:Style
var styleName:String
var styleString:String
function applyStyle():Void
function clone():StyleableDisplayObject
function invalidate(?type:Int, ?recursive:Bool):Void
function paint():Void
function retrieveStyle(id:String):Style
function storeStyle(id:String, value:Style):Void

Inherited from DisplayObjectContainer

var autoSize:Bool
var children:Array<IDisplayObject>
var layout:ILayout
var numChildren:Int
function addChild(child:IDisplayObject):IDisplayObject
function addChildAt(child:IDisplayObject, index:Int):IDisplayObject
function clone():DisplayObjectContainer
function contains(child:IDisplayObject):Bool
function dispose():Void
function findChild<T>(id:String, ?type:Class<T>, ?recursive:Bool):Null<T>
function findChildAs<T>(type:Class<T>):Null<T>
function findComponentUnderPoint(stageX:Float, stageY:Float):IDisplayObject
function getChildAt(index:Int):IDisplayObject
function indexOfChild(child:IDisplayObject):Int
function invalidate(?type:Int, ?recursive:Bool):Void
function removeAllChildren(?dispose:Bool):Void
function removeChild(child:IDisplayObject, ?dispose:Bool):IDisplayObject
function removeChildAt(index:Int, ?dispose:Bool):IDisplayObject
function setChildIndex(child:IDisplayObject, index:Int):Void

Inherited from DisplayObject

var alpha:Float
var graphics:Graphics
var height:Float
var horizontalAlign:String
var id:String
var includeInLayout:Bool
var parent:IDisplayObjectContainer
var percentHeight:Float
var percentWidth:Float
var ready:Bool
var root:Root
var sprite:Sprite
var stageX:Float
var stageY:Float
var useHandCursor:Bool
var verticalAlign:String
var visible:Bool
var width:Float
var x:Float
var y:Float
function addEventListener(type:String, listener:Dynamic ->Void?useCapture:Bool, ?priority:Int, ?useWeakReference:Bool):Void
function clone():DisplayObject
function dispatchEvent(event:Event):Bool
function dispose():Void
function hasEventListener(type:String):Bool
function hitTest(xpos:Float, ypos:Float):Bool
function invalidate(?type:Int, ?recursive:Bool):Void
function removeEventListener(type:String, listener:Dynamic ->Void?useCapture:Bool):Void
function removeEventListenerType(eventType:String):Void
function willTrigger(type:String):Bool

var allowFocus:Bool

Defines whether or not the button can receive focus by tabbing to it (not yet implemented)

var allowSelection:Bool

Defines whether this buttons selected state can be modified by the user. Only applicable for toggle buttons.

var group:String

Defines the group for this button. Toggle buttons belonging to the same group will only ever have a single option selected.

var icon:Dynamic

Sets the icon asset. Eg: assets/myicon.png

var iconPosition:String

Defines where the icon (if available) should be positioned, valid values are:

  • left - left of the label
  • top - top of the label
  • center - center of the button
  • right - right of the label
  • bottom - bottom of the label

var multiline:Bool

var remainPressed:Bool

Defines whether this button should remain pressed even when the mouse cursor goes out of the control (and the left mouse button is pressed)

var selected:Bool

Gets or sets the buttons selected state. Only applicable if the button is a toggle button.

var toggle:Bool

Defines whether this button should behave as a toggle button. Toggle buttons maintain thier selection, ie, one click to select, another to deselect

function new():Void

function applyStyle():Void

function clone():Button

function dispose():Void