イベント後にレイアウトを切り替えたい (つまり、ボタンをクリックする)。そこで、新しいレイアウトを設定してパネルを再描画しましたが、レイアウトは変わりません。(手動でフレームのサイズを変更した後にのみそうします。) 行方不明の魔法のソースは何ですか? 助けてくれてありがとう!
import Graphics.UI.WX
buildGUI = do
f <- frame [ text := "Hello" ]
controls <- panel f []
ctext <- staticText controls [ text := "Foo" ]
butn <- button controls [text := "change layout"]
set controls [ layout := row 0 [margin 5 (widget ctext),
margin 5 (widget butn) ]]
set f [ layout := widget controls ]
set butn [on command := do
-- switch layout, button first, text second
set controls [layout := row 0 [ margin 5 (widget butn)
, margin 5 (widget ctext) ]]
{-
repaint doesn't do it, but if I resize the frame by hand,
the layout changes
-}
repaint controls ]
return ()
main = start buildGUI