Windspeed Input (windSpeedInput) state variables represent user inputs for METAR-style windspeed strings (e.g., "10" or "10G15"). It is a type of unitInput that can support multiple windspeed units. Typically, this is wkt and wmps to match the METAR possibilities.
Like other unitInput state variables MVCS supports a physical or virtual keyboard, a popup keypad, or a thumbwheel input mechanism and selects the desired mechanism by referring to the set_numInputType state variable. See Standard Settings Page.
The standard keyboard mechanism will ignore invalid characters and automatically add a 'G' before the third typed number. The popup keypad is specialized so that only valid windspeed characters can be entered. The thumbwheel input is similarly specialized to quickly select valid windspeed strings. Invalid entries (e.g., gust less than wind) are ignored and will revert to the previous valid setting.
Here's a typical example of a page-specific windspeed and windspeed units:
ctl.createPage({
...,
stateVarInfo:[
{id:'page_windSpeed', type:'windSpeedInput',
unitClass:'page_windSpeed',
units:{wkt:{dflt:'0'}, wmps:{dflt:'0'}}
},
{id:'page_windSpeedUnit', type:'unitSelector',
unitClass:'page_windSpeed',
options: [
{value:'wkt', text:'kt.'},
{value:'wmps', text:'mps.'},
],
},
],
});
A unitSelector with the same unitClass will control which unit is displayed if the parent windSpeedInput is displayed. Here's an example:
ctl.create page({
...,
render () {
return (tml`
...
<Cr> <Cl>Wind speed</> <Cv>{{page_windSpeed}} {{page_windSpeedUnit}}</> </Cr>
`);
}
});
This will display a windspeed input box and a selector for the units.
'windSpeedInput', class: WindSpeedInputSvctl.createPage({
...,
stateVarInfo:[
{id:'page_windSpeed', type:'windSpeedInput',
unitClass:'page_windSpeed',
units:{wkt:{dflt:'0'}, wmps:{dflt:'0'}}
},
],
})
info
An object containing the state variable properties. The info object can contain the following properties, but subclasses of StateVar may have additional properties:
info properties.info properties.info properties.unitClassunitClass string for the unitSelector that controls which unit sibling is current for this state variable.unitsinfo object.The object for each unit has the following keys:
dflt (optional)valueOnlyIf true, the component renders the value as read-only text instead of an input.
A Boolean.
showUnitsIf true, the component renders the current unit label after the value.
A Boolean.
The component has no inputType attribute. It selects its input mechanism from the set_numInputType state variable (see Standard Settings Page). The values are:
'keyboard''keypad''thumbwheel'keyboard inputType, the component will render an <input type="text">.value attribute will be synchronized with the current unit sibling value.<span> element containing the windspeed text string.<span> contents will be synchronized with the state variable value.<input> element will have a className that contains windSpeed and svIo_windSpeedInput.inputType, the component will render a <span>.<span> contents will be synchronized with the state variable value.