
A numbercontrol is a window control that contains number data and is not bound to a database node. (See also numberfield)
The number is displayed in the specified font centered on the control.
The control supports the "number" dragdata type by default.
Definition

<numbercontrol name="..."
>
|
|
<description
>
|
The string used as the description of a data drag |
<text
>
...
</text>
|
A static string used as the description |
<field
>
...
</field>
|
The name of a data node under the window data source containing a string to use as the description |
</description>
|
|
<nodrag
/>
|
Disable acting as drag and drop source |
<nodrop
/>
|
Disable acting as a drag and drop target |
<noreset
/>
|
Disable reset by using the middle mouse button |
<displaysign
/>
|
Indicates the number should contain a "+" character when positive |
<hideonvalue
>
...
</hideonvalue>
|
If present, no number will be drawn for the number value specified here |
<font
>
...
</font>
|
The name of the font resource used to render the text in this control |
<color
>
...
</color>
|
The color used to draw the text, in the form #aarrggbb. If not present, the font default color is used |
<delaykeyupdate
/>
|
If present and editing the value of this control using the keyboard, changes won't be written to the database
and update event functions will not be called until the focus is moved away from the control |
<nokeyedit
/>
|
Disable keyboard based editing |
<readonly
/>
|
Disable all user interface based editing |
<keyeditframe
>
|
The bitmap frame used when the keyboard focus is on this control |
<name
>
...
</name>
|
The name of the bitmap frame resource |
<offset
>
...
</offset>
|
A comma separated list of four numbers, specifying the left, top, right and bottom margins in pixels, respectively |
</keyeditframe>
|
|
</numbercontrol>
|
|
Interface

getFont

function getFont(
)
Retrieves the name of the font resource used when rendering the contents of the control.
Return values
(string)
The name of a font resource
getValue

function getValue(
)
Retrieves the value of the control.
Return values
(number)
The value contained in the control
hasFocus

function hasFocus(
)
This function indicates whether the keyboard focus is in this control, i.e. if a keyboard edit action is underway.
Return values
(boolean)
Returns true if the control has the keyboard focus, false otherwise.
isReadOnly

function isReadOnly(
)
Checks if the control is flagged as read only.
Return values
(boolean)
Returns true if the control has the read only flag set, false otherwise
onValueChanged

event
function onValueChanged(
)
If present, this function is executed whenever the value of the number in this control changes.
setColor

function setColor(
color
)
Sets the color used when rendering the contents of the control. This setting overrides the color defined in the font used. To restore
the use of font resource color, specify nil as the parameter value.
The specified parameter is a color value in a HTML-style string representation, in the format "#AARRGGBB". The components are hexadecimal
digits specifying the value of the alpha (transparency), red, green and blue channels, respectively, in the range 0 .. 255.
Parameters
color (string)
The color to be used, or nil to reset the setting. See above for details on the string format.
setDescriptionField

function setDescriptionField(
name
)
Sets the name of the data node to be used as the source for the string used as the description in the dropdata created when this
control is acting as a drag and drop operation source. The node is found by fetching the child node corresponding with the name under the window
data source.
Parameters
name (string)
The name of the field used as the description string source
setDescriptionText

function setDescriptionText(
text
)
Sets the string used as the description in the dropdata created when this control is acting as a drag and drop operation source.
Parameters
text (string)
The string to use as the description. To disable the functionality, pass the empty string as the parameter.
setFocus

function setFocus(
[state]
)
This function requests the framework to either set or reset the keyboard focus to this control.
Parameters
state (boolean) [optional]
A value of true sets the focus to this control, a false value resets the focus.
When the parameter is omitted (synonymous to passing a nil value), the value is treated as true.
setFont

function setFont(
fontname
)
Sets the name of the font resource used to render the text in the control.
Parameters
fontname (string)
The name of a font resource
setReadOnly

function setReadOnly(
state
)
Sets the read only flag of the control.
Parameters
state (boolean)
A value of true sets the read only flag and a value of false disables it
setValue

function setValue(
value
)
Sets the value of the number in the control.
Parameters
value (number)
The value to set the control to