Update of /cvsroot/htoolkit/gio/src/examples/simple
In directory sc8-pr-cvs1:/tmp/cvs-serv4196/src/examples/simple
Added Files:
SimpleControls.hs
Log Message:
Add new example
--- NEW FILE: SimpleControls.hs ---
module Main where
import Graphics.UI.GIO
main = start "Controls" "1.0" SDI [] demo
demo :: IO ()
demo = do w <- window []
nb <- notebook [] w
-- Buttons page
pg1 <- notebookPage [title =: "Buttons"] nb
b1pg1 <- button [title =: "Button1", on command =: messageAlert "Button1 clicked"] pg1
b2pg1 <- button [title =: "Button2", on command =: messageAlert "Button2 clicked"] pg1
set pg1 [layout =: b1pg1 <<<< b2pg1]
-- page 2
pg2 <- notebookPage [title =: "Edit"] nb
lbl <- label [title =: "Comments"] pg2
edit <- entry [] pg2
chk <- checkBox [title =: "Read only", on command =: set edit [readOnly ~: not]] pg2
set pg2 [layout =: (lbl <<<< (hglue <<< chk)) ^^^ hfill (vfill (edit))]
-- radio buttons
rtop <- radioBox [title =: "top", on command =: set nb [labelsPosition =: PosTop ]] w
rleft <- radioBox [title =: "left", on command =: set nb [labelsPosition =: PosLeft ]] w
rbottom <- radioBox [title =: "bottom", on command =: set nb [labelsPosition =: PosBottom]] w
rright <- radioBox [title =: "right", on command =: set nb [labelsPosition =: PosRight ]] w
setRadioBoxGroup [rtop,rleft,rbottom,rright]
e <- entry [readOnly =: True, title =: "Hello, world!"] w
set w [layout =: (vertical [rtop,rleft,rbottom,rright] <<< vfill (hfill nb)) ^^^ hfill e]
|