packages feed

AutoForms-0.4.0: src/Examples/Misc/NonModalDialogTest.hs

-- This program is made to show an error in WxHaskell. It is not really a part of AutoForms.

-- Compile with ghc -fglasgow-exts --make NonModalDialogTest.hs -o NonModalDialogTest

module Main where

import Graphics.UI.WX
import System

main = start $ do
         f <- frame [ text := "Some program" ] -- , on closing := exitWith ExitSuccess ]
         okButton <- button f [ text := "OK", on command := putStr "Tester\n" ]
         --         w <- get f parent   -- if you use this the program do not terminate properly
         set f [ layout := widget okButton ]
         d <- dialog f [ text := "Some dialog" ]
         set d [ visible := True ]

{-

Added "on closing := exitWith ExitSuccess" to frame creating line. This makes the program
close properly (see http://sourceforge.net/mailarchive/forum.php?thread_id=9096517&forum_id=34197).
However, this is a workaround and not good for AutoForms.

-}