我想检索小部件值。
在下面,按下按钮 b 检索 s_in 并在本机 wxhaskell 中打印它。
b <- button f [text:= "print text in console",
on command := textCtrlGetValue s_in >>= putStrLn]
我喜欢在 reactive-banana 做同样的事情,但在下面,我得到“ff”而不是 s_in2 的 textCtrlGetValue
s_in <- textCtrl f []
s_in2 <- textCtrl f []
b <- button f [text:= "print text in console",
on command := textCtrlGetValue s_in >>= putStrLn]
let networkDescription :: forall t. Frameworks t => Moment t ()
networkDescription = do
b_in <- behaviorText s_in "init"
b_in2 <- behaviorText s_in2 "ff"
e_butt <- event0 b command
-- I need an event, triggered by the button, and filled by the b_in2,
sink s_in2 [text :== id <$> b_in]
reactimate $ (\x -> putStrLn x) <$> b_in2 <@ e_butt
接收器在 s_in 之后会很好地更新 sin_2。但是下面的反应行没有让我得到我希望得到的 s_in/b_in 的 textCtrlGetValue 。我怎么才能得到它 ?