如何从WxHaskell面板中删除小部件
我的谷歌fu让我失望了。如何删除添加到如何从WxHaskell面板中删除小部件,haskell,wxwidgets,wxhaskell,Haskell,Wxwidgets,Wxhaskell,我的谷歌fu让我失望了。如何删除添加到面板()中的小部件?例如,在下面的示例中,我希望控件-面板再次变为空 buildGUI = do f <- frame [ text := "Hello" ] controls <- panel f [] ctext <- staticText controls [ text := "Foo" ] set controls [ layout := margin 5 (widget ctext) ] set f [ l
面板()
中的小部件?例如,在下面的示例中,我希望控件
-面板再次变为空
buildGUI = do
f <- frame [ text := "Hello" ]
controls <- panel f []
ctext <- staticText controls [ text := "Foo" ]
set controls [ layout := margin 5 (widget ctext) ]
set f [ layout := widget controls ]
{- delete ctext ? How? -}
return ()
buildGUI=do
f您可以使其不可见并将其从布局中删除。这实际上不会删除它,但会动态更改UI:
import Graphics.UI.WX
buildGUI = do
f <- frame [ text := "Hello" ]
controls <- panel f []
ctext <- staticText controls [ text := "Foo" ]
butn <- button controls [text := "Remove the Foo"] -- I've added a button to remove Foo
set controls [ layout := row 0 [margin 5 (widget ctext),
margin 5 (widget butn) ]]
set f [ layout := widget controls ]
set butn [on command := do
set ctext [visible := False] -- so ctext doesn't show
set controls [layout := margin 5 (widget butn) ]] -- so ctext doesn't take up space
return ()
main = start buildGUI
import Graphics.UI.WX
buildGUI=do
f您可以使其不可见并将其从布局中删除。这实际上不会删除它,但会动态更改UI:
import Graphics.UI.WX
buildGUI = do
f <- frame [ text := "Hello" ]
controls <- panel f []
ctext <- staticText controls [ text := "Foo" ]
butn <- button controls [text := "Remove the Foo"] -- I've added a button to remove Foo
set controls [ layout := row 0 [margin 5 (widget ctext),
margin 5 (widget butn) ]]
set f [ layout := widget controls ]
set butn [on command := do
set ctext [visible := False] -- so ctext doesn't show
set controls [layout := margin 5 (widget butn) ]] -- so ctext doesn't take up space
return ()
main = start buildGUI
import Graphics.UI.WX
buildGUI=do
f是否尝试了可见
属性?是否尝试了可见
属性?