I attached the program to this e-mail, as the copy-paste in the previous one went horribly wrong (seems to be a Windows XP problem).

On Sat, 23 Jan 2010 22:41:16 +0100, Henk-Jan van Tuyl <hjgt...@chello.nl> wrote:

On Sat, 23 Jan 2010 17:33:33 +0100, Günther Schmidt <gue.schm...@web.de>
wrote:

Hi,

I'd like to be able to "fold" away a widget on button click. I manage to
make it disappear but the space it used to occupy is still occupied.

How can I "fold" it away? Like in a Tree View?

Günther


You could do it the like this (if you press the button "Remove me", its
place will be taken by button "Close"):

import Graphics.UI.WX

main :: IO ()
main = start $
 do
  f  <- frame   [ fontSize   := 18
                , clientSize := sz 200 200                ]

  ok0 <- button f [ on command := close f
                  , text       := "Close"                  ]
  ok1 <- button f [ text       := "Remove me"                  ]

  set ok1 [ on command :=              do                set ok1 [
visible := False ]
                set f   [ layout  := column 1 [ widget ok0 ] ]
          ]

  set f [ layout :=            column 1 [ widget ok1
                     , widget ok0
                     ]
        ]

  return ()


Met vriendelijke groet,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference attendees to learn about information security's most important issues through interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users


--
Met vriendelijke groet,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://functor.bamikanarie.com
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
  FoldingAWidget.lhs
  If you press the button "Remove me", its
  place will be taken by button "Close")

  2010-01-23

> import Graphics.UI.WX

> main :: IO ()
> main = start $
>  do
>   f  <- frame   [ fontSize   := 18
>                 , clientSize := sz 200 200 
>                 ]
>
>   ok0 <- button f [ on command := close f
>                   , text       := "Close" 
>                   ]
>   ok1 <- button f [ text       := "Remove me" 
>                   ]
>
>   set ok1 [ on command := 
>               do 
>                 set ok1 [ visible := False ]
>                 set f   [ layout  := column 1 [ widget ok0 ] ]  
>           ]
>
>   set f [ layout := 
>             column 1 [ widget ok1
>                      , widget ok0
>                      ]
>         ]
>
>   return ()

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to