1 Dec 2009 14:17
Re: Changing a label depending on real world data
This sounds as though it may be 'homework', so hints only - your professor may well be reading in any case. Please see http://www.haskell.org/haskellwiki/Homework_help for more information. - To make something happen when you press a button, you need to add an event handler to the button. - One way of doing this in wxHaskell is to reference the event handler in the button attributes when you create it. - Your event handler needs to be able to identify the text label so that it can update it with new contents. Almost all functions in wxHaskell run in the IO monad, as you have observed. While you cannot 'take away' the IO, you can use values which are embedded with an IO type, for example, suppose you have a function (these are deliberately not quite the same as the 'real' wxHaskell functions, but should give you an idea): button :: Window -> [Attribute] -> IO Button frame :: Maybe Window -> [Attribute] -> IO Frame You can create a button in a frame with code something like the following:(Continue reading)
RSS Feed