QCounter
| Extends: | QControl |
| Requires: |
<script language="JavaScript" src="js/qlib/control.js"></script>
<script language="JavaScript" src="js/qlib/imagelist.js"></script>
<script language="JavaScript" src="js/qlib/counter.js"></script>
|
Description
Creates an animated digital indicator that can display only positive integers.
The control can be set by a negative value, in such case zero is displayed.
An imagelist should be provided as a resource, it must include at least eleven elements,
the first ten should be images of digits from 0 to 9, the last one is used to fill off segments.
See Also
Constructor
QCounter(parent, name, res, sizeopt, effectopt) |
Creates an animated digital indicator from the resource provided. If the counter is created as
a child control, valid parent object must be specified. If the counter 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 - Imagelist resource (see QImageList for details).
size - Optional. Defines number of segments. Default value is 4.
effect - Optional. Specifies animation effect used to scroll the counter. Default value is QCounter.FAST.
|
Properties
| Property | Access | Description |
res | R | Refers to the resource object used to create the counter. |
value | R | Returns value that is currently displayed by the indicator. This property is changing during animation. |
setval | R | Returns the value by which the indicator has been set. Doesn't depend on animation. |
size | R | Number of the digit segments. |
effect | R / W | Sets or retrieves animation effect that is used to scroll the indicator. |
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) |
Sets new value to be displayed by the indicator. Regardless the value specified,
only positive integers are displayed, zero otherwise.
Parameters
value - New value to display.
|
update() |
|
Updates the component on the screen according to its current state.
|
Class Constants
| Constant | Description |
QCounter.INSTANT | Suppresses the indicator scrolling, new value gets displayed instantly. |
QCounter.FAST | According to fast scrolling, the indicator reaches new value in 10 steps regardless the increment (default effect). |
QCounter.SLOW | Due to slow scrolling, the indicator reaches new value increasing or decreasing current value by 1. |
CSS Class Selectors
| CSS Class | Description | Example (defined in a CSS file) |
TABLE.qcounter | Defines style properties of a counter's TABLE element. | TABLE.qcounter { background-color: green } /* fills background using green color. */ |
TABLE.qcounter TD | Defines style of a segment. | TABLE.qcounter TD { padding: 2px } /* sets 2px spacing around each segment. */ |