> I propose a simple program which pops up a
window saying
> 'Hello World' with a button saying 'Bye' which you click
and it changes
> the message to 'Goodbye'. if you click the button again
the program
> exits.
I have been thinkering with the wxWindows
library
and made a small Haskell binding to it that just
supports this
example. It was an interesting exercise since the
wxWindows library
is a large object-oriented C++ library. (but very
portable, well supported,
efficient and with lots of super widgets, like an
openGL canvas and a HTML
renderer)
Anyhow, I think it comes out rather nicely and I am
quite surprised how
well the wxWindows library lends itself to Haskell
access.
-- Daan.
-----------------------------------------------------------------
main
= wxRun $
do w <- wxCreateFrame wxFRAME_DEFAULT_STYLE
wxSetWindowBackgroundColor w white
wxSetWindowSize w (Size 100 80)
wxSetFrameTitle w "Bye!"
l <- wxCreateLabel w "Hello World"
wxSetWindowPosition l (Point 10 5)
b <- wxCreateButton w "Bye"
wxSetWindowPosition b (Point 10 25)
wxSetButtonOnCommand b (bye w b l)
wxShowWindow w
where
bye w b l
= do wxSetControlLabel l "Goodbye"
wxSetButtonOnCommand b (wxWindowClose w False)