From: Rolf H. <rol...@st...> - 2009-05-24 08:46:01
|
Hello wxhaskell users, I'm new to wxhaskell and I can't solve the following problem on my own (tried to find a solution online for hours). What I'm trying to do is simple: I want to display the time from now until a time in the future. For which I read the current time with getClockTime, do some calculations and then paint the time. The following compiles but quits immediately when I run the app (no error). ... demo :: IO () demo = do f <- frameFixed [text := "Countdown"] currenttime <- getClockTime p <- panel f [on paint := (writeTimeDiff currenttime) ] set f [layout := fill $ container p $ margin 10 $ column 5 []] writeTimeDiff :: ClockTime -> DC a -> Rect -> IO () writeTimeDiff currenttime dc _ = drawText dc (getTimeDiff currenttime) (Point 2 2) [] getTimeDiff :: ClockTime -> String getTimeDiff = calendarTimeToString . toUTCTime . timeDiffToClockTime . (diffClockTimes eta) where eta = toClockTime (CalendarTime 2010 January 1 16 45 0 0 Thursday 0 "CEST" 0 False) ... Don't worry about how I calculate the time difference. Imho the problem has something to do with currenttime <- getClockTime I hope anyone sees a problem in the code. I have the feeling that I'm missing something fundamental here. Thanks in advance, Rolf |