Class s7sdk.common.Button
The Button
base class manages the core logic and behavior for
the various button sub-classes that are provided with the SDK. It is an abstract base class
that should not be instantiated directly.
Constructor Attributes | Constructor Name and Description |
---|---|
s7sdk.common.Button(id, pid, imgs, w, h, css, settings)
|
Method Attributes | Method Name and Description |
---|---|
activate()
Enables the button.
|
|
addEventListener(type, handler, useCapture)
Adds an event listener to the button.
|
|
blur()
Removes focus from component. |
|
Disables the button.
|
|
dispose()
Dispose is used to remove itself and all sub-elements from the DOM.
|
|
focus()
Puts focus on component if it is currently active. |
|
Returns the current inner height of the component.
|
|
getWidth()
Returns the current inner width of the component.
|
|
resize(w, h)
Resize the button.
|
|
setCSS(classname, property, value)
Sets a particular CSS class and property on a component
|
Class Detail
s7sdk.common.Button(id, pid, imgs, w, h, css, settings)
- Parameters:
- {String} id
- An optional parameter that specifies the ID of the components DOM element
- {String} pid
- ID The ID of the parent DOM element to which the component is added as a child...
- {Object} imgs
- Deprecated: An array of images for four stages [up,down,over,disable] or null for unset. Now use CSS for this purpose.
- {int} w
- Width in pixels.
- {int} h
- Height in pixels.
- {String} css
- CSS class for button.
- {s7sdk.ParameterManager} settings
- A parameter manager instance that represents the desired configuration..
Method Detail
activate()
Enables the button. After this call the button will be in one of the following states:
depending on user interaction and the appropriate styling attribute will apply:
up
down
over
depending on user interaction and the appropriate styling attribute will apply:
[state=up|down|over]
.
addEventListener(type, handler, useCapture)
Adds an event listener to the button. The handler function
receives a DOM event object of type
Event
.
The events supported by the component are:
click
- Dispatched when a user clicks/taps the component.- Parameters:
- {String} type
- Event name, in this case
click
. - {Function} handler
- Function to be called when the event gets dispatched.
- {Boolean} useCapture
- Register capture phase.
blur()
Removes focus from component.
deactivate()
Disables the button. After this call the button will be in the
disabled
state. The styling for [state=disabled]
will apply.
dispose()
Dispose is used to remove itself and all sub-elements from the DOM.
focus()
Puts focus on component if it is currently active.
{Number}
getHeight()
Returns the current inner height of the component.
- Returns:
- {Number} the inner height of the component, in pixels.
{Number}
getWidth()
Returns the current inner width of the component.
- Returns:
- {Number} the inner width of the component, in pixels.
resize(w, h)
Resize the button.
- Parameters:
- {Number} w
- Width in pixels.
- {Number} h
- Height in pixels.
setCSS(classname, property, value)
Sets a particular CSS class and property on a component
- Parameters:
- {String} classname
- The CSS classname to use for this style. i.e. .s7closebutton
- {String} property
- The CSS property that is being set. i.e. background-color
- {String} value
- The CSS property value being set. i.e. #FF0000