Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,30 @@
|
|||
import Graphics.UI.Gtk
|
||||
import Data.IORef
|
||||
|
||||
main :: IO ()
|
||||
main = do
|
||||
initGUI
|
||||
window <- windowNew
|
||||
window `onDestroy` mainQuit
|
||||
windowSetTitle window "Simple Windowed App"
|
||||
set window [ containerBorderWidth := 10 ]
|
||||
|
||||
hbox <- hBoxNew True 5
|
||||
|
||||
set window [ containerChild := hbox ]
|
||||
|
||||
lab <- labelNew (Just "There have been no clicks yet")
|
||||
button <- buttonNewWithLabel "Click me"
|
||||
set hbox [ containerChild := lab ]
|
||||
set hbox [ containerChild := button ]
|
||||
|
||||
m <- newIORef 0
|
||||
|
||||
onClicked button $ do
|
||||
v <- readIORef m
|
||||
writeIORef m (v+1)
|
||||
set lab [ labelText := "There have been " ++ show (v+1) ++ " clicks" ]
|
||||
|
||||
widgetShowAll window
|
||||
|
||||
mainGUI
|
||||
Loading…
Add table
Add a link
Reference in a new issue