Go to the first, previous, next, last section, table of contents.

Examples of selector instances

A Selector allows you to configure the following:

Default values for the different options are provided, so creating a new Selector only requires you to override the default values you want to. The defaults provided gives you a push button like behaviour and feedback:


mkSelector :: SelectorResource -> a -> DC -> IO (Selector a, DisplayHandle)

main =
 mkDC []              >>= \dc ->
  mkSelector [] () dc >>= \ (sel, dh) ->
 realiseDH dc dh      >>
 return ()

A single selector is displayed in a window,

Selector instance

To dynamically add a label,


setSelectorLabel :: Selector a -> Picture -> IO ()

main =
 ..as before..
 setSelectorLabel sel (text "Hello, world!")

Labelled Selector

The mkSelector function returns an abstract Selector handle that is used to change the label. This handle is also used to receive selector `clicks' by the application


getSelectorClick :: Selector a -> IO a

which returns a value of type a each time a selector interaction has completed (more on this later). The value returned is the same as the second argument given to mkSelector.


Go to the first, previous, next, last section, table of contents.