wxHaskell を使ってみる。


サンプルをゴニョゴニョいじってみる。
(:=) でプロパティをセット。

module Main where
import Graphics.UI.WX

main :: IO ()
main = start hello

hello :: IO ()
hello
  = do f     <- frame    [text := "日本語はUTF8で!"]
       p     <- panel    f []
       title <- get      f text  -- frame の text を取得 
       -- 終了、表示ボタンの定義。 p は親オブジェクトのパネル。
       quit  <- button p [text := "終了", on command := close f]
       inf   <- button p [text := "表示", on command := infoDialog f "Info" title]
       set f [defaultButton := inf,
              layout := container p 
                        (margin 10 
                          (column 5   -- 5行   
                                 [boxed "ラベル表示" 
                                       (column 7 
                                               [ floatLeft   (label "ラベル:左寄せ")
                                                ,floatCentre (label "ラベル:中央")
                                                ,floatRight  (label "ラベル:右寄せ")] )
                                  , floatBottomRight (
                                     row 5
                                     -- スペース・ボタン・スペース・ボタン・スペース
                                          [widget quit,
                                           widget inf  ])]  )) ]

「表示」ボタンを押したとき出るダイアログ。