Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Input field for numeric types.
Supports instances of the FromFractional
typeclass. Several basic types are
implemented, both for integer and floating point types.
Handles mouse wheel and shift + vertical drag to increase/decrease the number.
Configs:
- validInput: field indicating if the current input is valid. Useful to show warnings in the UI, or disable buttons if needed.
- resizeOnChange: Whether input causes ResizeWidgets requests.
- selectOnFocus: Whether all input should be selected when focus is received.
- minValue: Minimum valid number.
- maxValue: Maximum valid number.
- wheelRate: The rate at which wheel movement affects the number.
- dragRate: The rate at which drag movement affects the number.
- onFocus: event to raise when focus is received.
- onFocusReq: WidgetRequest to generate when focus is received.
- onBlur: event to raise when focus is lost.
- onBlurReq: WidgetRequest to generate when focus is lost.
- onChange: event to raise when the value changes.
- onChangeReq: WidgetRequest to generate when the value changes.
- decimals: the maximum number of digits after the decimal separator. Defaults to zero for integers and two for floating point types.
Synopsis
- numericField :: (FormattableNumber a, WidgetEvent e) => ALens' s a -> WidgetNode s e
- numericField_ :: (FormattableNumber a, WidgetEvent e) => ALens' s a -> [NumericFieldCfg s e a] -> WidgetNode s e
- numericFieldV :: (FormattableNumber a, WidgetEvent e) => a -> (a -> e) -> WidgetNode s e
- numericFieldV_ :: (FormattableNumber a, WidgetEvent e) => a -> (a -> e) -> [NumericFieldCfg s e a] -> WidgetNode s e
Documentation
numericField :: (FormattableNumber a, WidgetEvent e) => ALens' s a -> WidgetNode s e Source #
Creates a numeric field using the given lens.
numericField_ :: (FormattableNumber a, WidgetEvent e) => ALens' s a -> [NumericFieldCfg s e a] -> WidgetNode s e Source #
Creates a numeric field using the given lens. Accepts config.
numericFieldV :: (FormattableNumber a, WidgetEvent e) => a -> (a -> e) -> WidgetNode s e Source #
Creates a numeric field using the given value and onChange event handler.
numericFieldV_ :: (FormattableNumber a, WidgetEvent e) => a -> (a -> e) -> [NumericFieldCfg s e a] -> WidgetNode s e Source #
Creates a numeric field using the given value and onChange event handler. Accepts config.