@@ -108,12 +108,14 @@ checkboxStyleTick = CheckboxStyle
108108data CheckboxConfig t = CheckboxConfig
109109 { _checkboxConfig_checkboxStyle :: Behavior t CheckboxStyle
110110 , _checkboxConfig_attributes :: Behavior t V.Attr
111+ , _checkboxConfig_setValue :: Event t Bool
111112 }
112113
113114instance (Reflex t) => Default (CheckboxConfig t) where
114115 def = CheckboxConfig
115116 { _checkboxConfig_checkboxStyle = pure def
116117 , _checkboxConfig_attributes = pure V.defAttr
118+ , _checkboxConfig_setValue = never
117119 }
118120
119121-- | A checkbox widget
@@ -127,9 +129,10 @@ checkbox cfg v0 = do
127129 mu <- mouseUp
128130 space <- key (V.KChar ' ')
129131 f <- focus
130− v <- toggle v0 $ leftmost
131− [ () <$ mu
132− , () <$ space
132+ v <- foldDyn ($) v0 $ leftmost
133+ [ not <$ mu
134+ , not <$ space
135+ , const <$> _checkboxConfig_setValue cfg
133136 ]
134137 let bold = V.withStyle mempty V.bold
135138 depressed <- hold mempty $ leftmost