Class YAHOO.ext.Button
Simple Button class
Config Options
|
handler : Function |
Button |
A function called when the button is clicked (can be used instead of click event) |
|
minWidth : Number |
Button |
The minimum width for this button (used to give a set of buttons a common width) |
|
scope : Object |
Button |
The scope of the handler |
|
text : String |
Button |
The button text |
Public Properties
This class has no public properties.
Public Methods
|
Button(String/HTMLElement/Element renderTo , Object config ) |
Button |
Create a new button |
|
addListener(String eventName , Function handler , [Object scope ], [boolean override ]) : void |
Observable |
Appends an event handler to this component |
|
bufferedListener(String eventName , Function handler , [Object scope ], [Number millis ]) : Function |
Observable |
Appends an event handler to this component that is buffered. If the event is triggered more than once
in the specifie... |
|
delayedListener(String eventName , Function handler , [Object scope ], [Number delay ]) : Function |
Observable |
Appends an event handler to this component that is delayed the specified number of milliseconds. This
is useful for e... |
|
disable() : void |
Button |
Disable this button |
|
enable() : void |
Button |
Enable this button |
|
fireEvent(String eventName , Object... args ) : Boolean |
Observable |
Fires the specified event with the passed parameters (minus the event name). |
|
focus() : void |
Button |
Focus the button |
|
getEl() : YAHOO.ext.Element |
Button |
Returns the buttons element |
|
hide() : void |
Button |
Hide this button |
|
on(String eventName , Function handler , [Object scope ], [boolean override ]) : void |
Observable |
Appends an event handler to this element (shorthand for addListener) |
|
purgeListeners() : void |
Observable |
Removes all listeners for this object |
|
removeListener(String eventName , Function handler , [Object scope ]) : void |
Observable |
Removes a listener |
|
setHandler(Function handler , [Object scope ]) : void |
Button |
Sets this buttons click handler |
|
setText(String text ) : void |
Button |
Set this buttons text |
|
setVisible(Boolean visible ) : void |
Button |
Convenience function for boolean show/hide |
|
show() : void |
Button |
Show this button |
Public Events
|
click : (Button this , EventObject e ) |
Button |
Fires when this button is clicked |
Config Details
handler
handler : Function
A function called when the button is clicked (can be used instead of click event)
This config option is defined by Button.
minWidth
minWidth : Number
The minimum width for this button (used to give a set of buttons a common width)
This config option is defined by Button.
scope
scope : Object
The scope of the handler
This config option is defined by Button.
text
text : String
The button text
This config option is defined by Button.
Constructor Details
Button
public function Button(String/HTMLElement/Element renderTo
, Object config
)
Method Details
addListener
public function addListener(String eventName
, Function handler
, [Object scope
], [boolean override
])
Appends an event handler to this component
Parameters:
eventName
: StringThe type of event to listen for
handler
: FunctionThe method the event invokes
scope
: Object(optional) The scope (this object) for the handler
override
: boolean(optional) If true, scope becomes the scope
Returns:
bufferedListener
public function bufferedListener(String eventName
, Function handler
, [Object scope
], [Number millis
])
Appends an event handler to this component that is buffered. If the event is triggered more than once
in the specified time-frame, only the last one actually fires.
Parameters:
eventName
: StringThe type of event to listen for
handler
: FunctionThe method the event invokes
scope
: Object(optional) The scope (this object) for the handler
millis
: Number(optional) The number of milliseconds to buffer (defaults to 250)
Returns:
delayedListener
public function delayedListener(String eventName
, Function handler
, [Object scope
], [Number delay
])
Appends an event handler to this component that is delayed the specified number of milliseconds. This
is useful for events that modify the DOM and need to wait for the browser to catch up.
Parameters:
eventName
: StringThe type of event to listen for
handler
: FunctionThe method the event invokes
scope
: Object(optional) The scope (this object) for the handler
delay
: Number(optional) The number of milliseconds to delay (defaults to 1 millisecond)
Returns:
disable
public function disable()
This method is defined by Button.
enable
public function enable()
This method is defined by Button.
fireEvent
public function fireEvent(String eventName
, Object... args
)
Fires the specified event with the passed parameters (minus the event name).
focus
public function focus()
This method is defined by Button.
getEl
public function getEl()
Returns the buttons element
This method is defined by Button.
hide
public function hide()
This method is defined by Button.
on
public function on(String eventName
, Function handler
, [Object scope
], [boolean override
])
Appends an event handler to this element (shorthand for addListener)
Parameters:
eventName
: StringThe type of event to listen for
handler
: FunctionThe method the event invokes
scope
: Object(optional) The scope (this object) for the handler
override
: boolean(optional) If true, scope becomes the scope
Returns:
purgeListeners
public function purgeListeners()
Removes all listeners for this object
removeListener
public function removeListener(String eventName
, Function handler
, [Object scope
])
setHandler
public function setHandler(Function handler
, [Object scope
])
Sets this buttons click handler
This method is defined by Button.
setText
public function setText(String text
)
This method is defined by Button.
setVisible
public function setVisible(Boolean visible
)
Convenience function for boolean show/hide
This method is defined by Button.
show
public function show()
This method is defined by Button.
Event Details
click
public event click
Fires when this button is clicked
Subscribers will be called with the following parameters:
this
: Buttone
: EventObjectThe click event
This event is defined by Button.
yui-ext - Copyright © 2006 Jack Slocum. |
Yahoo! UI - Copyright © 2006 Yahoo! Inc.
All rights reserved.