QButton
| Extends: | QControl |
| Requires: |
<script language="JavaScript" src="js/qlib/control.js"></script>
<script language="JavaScript" src="js/qlib/buttonres.js"></script>
<script language="JavaScript" src="js/qlib/button.js"></script>
|
Description
QLIB button is a flexible control that can be customized to serve either as a normal clickable button
or as a checkbox. Additionally to these common control types QLIB introduces a web-button and a signal.
Button control may have an optinal tooltip.
See Also
Constructor
QButton(parent, name, res, tooltipopt) |
Creates a customizable button from the resource provided. If the button is created as
a child control, valid parent object must be specified. If the button object is assigned
to global variable, parent should be null. The name should
be the same as the name of variable or property that has been assigned by newly created object.
Parameters
parent - Parent control (if any, null otherwise).
name - The object reference name.
res - Button resource (see QButtonRes for details).
tooltip - Optional tooltip text.
|
Properties
| Property | Access | Description |
res | R | Refers to the resource object used to create the button. |
value | R | Returns current button position as follows: 1 - pressed; 0 - released. |
enabled | R | Indicates whether the button is in "enabled" state. When disabled, a button doesn't react neither on hits nor on calls of set method. |
Properties inherited from QControl |
name | R | Name of the control. Serves as a direct reference to this object when evaluated. |
id | R | Alphanumerical unique identifier of the control. |
parent | R | Reference to the parent control (if any, null otherwise). |
tag | R / W | Can refer any value or object, tag is always passed to all event handlers as the last parameter. |
window | R | This property is a reference to JavaScript window object in which the control exists. |
document | R | Refers to document object in which the corresponding HTML elements exist. Normally all elements of a DOM2 compatible browser are children of the top document object. If the control creates new document scope (i.e. printing tags like <IFRAME>, <LAYER>), it should assign this document to this property. |
Methods
set(value) |
Forces the button position to change to desirable state. This method has no effect when button is disabled.
Parameters
value - Desirable state as follows: 0 - released, 1 - pressed.
Returns
Always returns true value.
|
enable(state) |
Enables or disables the button control.
Parameters
state - If true, this component is enabled; otherwise this component is disabled.
|
update() |
|
Updates the component on the screen according to its current state.
|
Event Handlers
onClick(value, tag) |
Is raised by the button when user clicks on the button. Button doesn't raise any events when disabled.
Parameters
value - Presents the button state after it reacted on the event.
tag - Tag is commonly used to parameterize the event handler. Each control can be optionally assigned by a tag.
Returns
The return value is ignored.
|
Class Constants
| Constant | Description |
QButton.NORMAL | Creates a normal button. |
QButton.CHECKBOX | Creates a double-state toggle, known as a checkbox. |
QButton.WEB | Creates a web-button. Unlike normal button, a web-button changes its state when mouse pointer moves over it. |
QButton.SIGNAL | Creates a signal icon. Unlike buttons, a signal doesn't react on user activity. This button style is useful when you want to have an icon that changes its appearance on application internal events. |
CSS Class Selectors
| CSS Class | Description | Example (defined in a CSS file) |
IMG.qbutton | Defines style properties of a button's IMG element. | IMG.qbutton { margin: 10px } /* creates 10px spacing around a button. */ |