【发布时间】:2012-11-06 06:57:15
【问题描述】:
我一直试图弄清楚如何使用 wxHaskell 调整 staticText 元素的大小以适应其内容。据我所知,这是 wxWidgets 中的默认行为,但 wxHaskell 包装器专门禁用了此行为。但是,创建新元素的库代码让我很困惑。谁能解释一下这段代码的作用?
staticText :: Window a -> [Prop (StaticText ())] -> IO (StaticText ())
staticText parent props
= feed2 props 0 $
initialWindow $ \id rect ->
initialText $ \txt -> \props flags ->
do t <- staticTextCreate parent id txt rect flags {- (wxALIGN_LEFT + wxST_NO_AUTORESIZE) -}
set t props
return t
我知道feed2 x y f = f x y,而且initialWindow的类型签名是
initialWindow :: (Id -> Rect -> [Prop (Window w)] -> Style -> a) -> [Prop (Window w)] -> Style -> a
initialText 的签名是
initialText :: Textual w => (String -> [Prop w] -> a) -> [Prop w] -> a
但我无法理解所有的 lambda。
【问题讨论】:
标签: haskell wxwidgets wxhaskell