L.S.,

The attached program can display English and Dutch text, depending on the button pressed; the title switches as well. However, the static text in the window dissappears when I resize the window. Is this a bug in wxHaskell/wxWidgets?

How can I create a proper wxHaskell GUI with selectable language?

--
Regards,
Henk-Jan van Tuyl


--
http://functor.bamikanarie.com
http://Van.Tuyl.eu/
--

2009-03-04

SimpleMultilingualWindow.lhs
An example of a program with several languages to be chosen from

Status: not correct yet

Compile with:
  ghc --make -Wall SimpleMultilingualWindow.lhs -dcore-lint -o SimpleMultilingualWindow -optl-s


> import Graphics.UI.WX

> data Language = Dutch | English deriving (Eq)

> main :: IO ()
> main = start $
>  do
>   f  <- frame          [ fontSize     := 18
>                        , tabTraversal := True 
>                        ]
>   
>   exit <- button f     [ on command := close f
>                        , text       := "Exit" 
>                        ]
>
>   st1  <- staticText f [  ]
>   st2  <- staticText f [  ]
>   

N.B. With the code below, resizing the window will blank out the staticTexts

>   dutch <- button f    [ on command := sequence_ [ set f   [text := "Nederlandse titel"]
>                                                  , set st1 [text := "Nederlandse tekst"]
>                                                  ]
>                        , text       := "Nederlands" 
>                        ]
>   
>   english <- button f  [ on command := sequence_ [ set f   [text := "English title"]
>                                                  , set st1 [text := "English text"]
>                                                  ]
>                        , text       := "English" 
>                        ]

>   set f [ layout :=
>             margin 10 ( column 20 [ widget st1
>                                   , widget st2
>                                   , widget dutch 
>                                   , widget english 
>                                   , widget exit 
>                                   ]
>                       )
>         ]
>
>   return ()

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to