monomer-1.1.1.0: A GUI library for writing native Haskell applications.
Copyright(c) 2018 Francisco Vallarino
LicenseBSD-3-Clause (see the LICENSE file)
Maintainerfjvallarino@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Monomer.Widgets.Singles.NumericField

Description

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.

Synopsis

Configuration

data NumericFieldCfg s e a Source #

Configuration options for numericField:

  • 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.

Instances

Instances details
Semigroup (NumericFieldCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

(<>) :: NumericFieldCfg s e a -> NumericFieldCfg s e a -> NumericFieldCfg s e a #

sconcat :: NonEmpty (NumericFieldCfg s e a) -> NumericFieldCfg s e a #

stimes :: Integral b => b -> NumericFieldCfg s e a -> NumericFieldCfg s e a #

Monoid (NumericFieldCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Default (NumericFieldCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

def :: NumericFieldCfg s e a #

CmbDecimals (NumericFieldCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

decimals :: Int -> NumericFieldCfg s e a Source #

CmbResizeOnChange (NumericFieldCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

CmbSelectOnFocus (NumericFieldCfg s e a) Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

CmbCaretMs (NumericFieldCfg s e a) Int Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

caretMs :: Int -> NumericFieldCfg s e a Source #

CmbCaretWidth (NumericFieldCfg s e a) Double Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

CmbWheelRate (NumericFieldCfg s e a) Double Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

CmbDragRate (NumericFieldCfg s e a) Double Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

FormattableNumber a => CmbMaxValue (NumericFieldCfg s e a) a Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

maxValue :: a -> NumericFieldCfg s e a Source #

FormattableNumber a => CmbMinValue (NumericFieldCfg s e a) a Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

minValue :: a -> NumericFieldCfg s e a Source #

CmbValidInputV (NumericFieldCfg s e a) e Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

validInputV :: (Bool -> e) -> NumericFieldCfg s e a Source #

CmbValidInput (NumericFieldCfg s e a) s Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

WidgetEvent e => CmbOnChange (NumericFieldCfg s e a) a e Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

onChange :: (a -> e) -> NumericFieldCfg s e a Source #

WidgetEvent e => CmbOnBlur (NumericFieldCfg s e a) e Path Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

onBlur :: (Path -> e) -> NumericFieldCfg s e a Source #

WidgetEvent e => CmbOnFocus (NumericFieldCfg s e a) e Path Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

onFocus :: (Path -> e) -> NumericFieldCfg s e a Source #

CmbOnChangeReq (NumericFieldCfg s e a) s e a Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

onChangeReq :: (a -> WidgetRequest s e) -> NumericFieldCfg s e a Source #

CmbOnBlurReq (NumericFieldCfg s e a) s e Path Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

onBlurReq :: (Path -> WidgetRequest s e) -> NumericFieldCfg s e a Source #

CmbOnFocusReq (NumericFieldCfg s e a) s e Path Source # 
Instance details

Defined in Monomer.Widgets.Singles.NumericField

Methods

onFocusReq :: (Path -> WidgetRequest s e) -> NumericFieldCfg s e a Source #

type FormattableNumber a = (Eq a, Ord a, Show a, NumericTextConverter a, Typeable a) Source #

Constraints for numeric types accepted by numericField.

class NumericTextConverter a Source #

Converts a numeric instance to and from Text.

Minimal complete definition

numericAcceptText, numericFromText, numericToText, numericToFractional, numericFromFractional

Constructors

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.