form.addNumberField¶
since 1.1.0
Add a number field to the current form.
Parameters¶
| Name | Type | Required | Description |
|---|---|---|---|
line |
FormLine | yes | the line where the field should be added |
rect |
Rect | yes | the coordinates |
min |
integer | yes | the min value |
max |
integer | yes | the max value |
getValue |
function | yes | the function which will return the current value |
setValue |
function | yes | the function which will be called on value change |
Returns¶
The new field
Examples¶
From the official Ethos documentation
local myField = form.addNumberField(line, nil, minValue, maxValue, function() return value end, function(newValue) value = newValue end)
myField:suffix("mAh")
myField:default(0)
myField:step(2)
Used in¶
- Background alert task
- Battery gauge widget
- System tool with a form
- Timer control
- Telemetry value widget
- lazy-loading
- task
- tool-form
- tool-servo
- widget-gauge
- widget-jet
Real-world usage¶
Called 229 times across 6 open-source Ethos Lua projects. A few short excerpts: