haddock description
-------------------
XTC: eXtended & Typed Controls for wxHaskell

The XTC library provides a typed interface to several wxHaskell controls.

    * radio view (typed radio box)
    * single-selection list view (typed single-selection list box)
    * muliple-selection list view (typed multiple-selection list box)
    * choice view (typed choice box)
    * value entry (typed text entry) 

XTC controls keep track of typed values and items, rather than being string
based. Selections in XTC controls consist of actual values instead of indices. 

my comments
-----------
The XTC library was developed in Utrecht University, and has been used
in a large wxhaskell appplication called Dazzle.  You can read more
about XTC and Dazzle in their Haskell Workshop paper from 2005
   http://www.cs.uu.nl/dazzle/f08-schrage.pdf

I attach a small screenshot and sample code (the sample code is
slightly updated from the hackage version to better convey the
possible usefulness of XTC)

-- 
Eric Kow <http://www.nltg.brighton.ac.uk/home/Eric.Kow>
PGP Key ID: 08AC04F9
import Graphics.UI.WX
import Graphics.UI.XTC

data Fruit = Apple | Banana | Orange deriving Show

instance Labeled Fruit where
  toLabel = show

instance Labeled Float where
  toLabel = show

main :: IO ()
main = start $
 do {
    ; f <- frame []
    ; counterV <- mkValueEntry f [ typedValue := Just 1 ]

    ; listV <- mkListView f [ typedItems := ["abc", "def"]
                            , enabled := True
                            ]

    ; radioV <- mkRadioView f Vertical [ 2.17, 3.14 :: Float ] []
    ; choiceV <- mkChoiceView f [ typedItems := [ Apple, Banana, Orange ]
                               , enabled := True
                               ]
--    ; comboV <- mkComboView f [ typedItems := ["sdfsdf", "fdssd"]
--                              , enabled := True
--                              ]
    ; t  <- textCtrl f []
    ; ve <- mkValueEntry f [ typedValue := Just True ]
--    ; set t [ on (change counterV) := \i -> set t [ text := show i ] ]

    ; bUp   <- button f [ text := "increase"
                        , on command := set counterV [ typedValue :~ fmap (+1) 
] ]
    ; bDown <- button f [ text := "decrease"
                        , on command := set counterV [ typedValue :~ fmap (+ 
(-1::Int)) ]]

    ; let refreshT =
           do { -- s1 <- get comboV typedSelection
              ; s1 <- get radioV typedSelection
              ; s2 <- get listV typedMaybeSelection
              ; s3 <- get counterV typedValue
              ; s4 <- get choiceV typedMaybeSelection
              ; set t [ text := unlines [ "radio: " ++ show s1
                      , "list:  " ++ show s2
                      , "counter: " ++ show s3
                      , "choice: " ++ show s4 ] ]
              }

    ; set bUp     [ on command :~ (>> refreshT) ]
    ; set bDown   [ on command :~ (>> refreshT) ]
    ; set listV   [ on select  :~ (>> refreshT) ]
    ; set radioV  [ on select  :~ (>> refreshT) ]
    ; set choiceV [ on select  :~ (>> refreshT) ]

--    ; bChangeHandler <- button f [ text := "change handler"
--                                 , on command := set t [ on (change counterV) 
:= \i -> set t [text := "<<"++show i++">>"] ]]
    ; set f [ layout := column 5 [ row 5 [ Graphics.UI.WX.label "Counter 
value:", widget counterV ]
                                 , hfloatCenter $ row 5 [ widget bUp, widget 
bDown ]
                                 --, hfloatCenter $ widget bChangeHandler
                                 , widget listV
                                 , widget radioV
                                 , widget choiceV
--                                 , widget comboV
                                 , widget ve
                                 , glue
                                 , hfill $ widget t
                                 ]
                                 ]

    }

<<attachment: xtc-example.png>>

Attachment: pgpCpwQOcqH3A.pgp
Description: PGP signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
wxhaskell-users mailing list
wxhaskell-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxhaskell-users

Reply via email to