1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  | 
module support_button
// ********************************************************************************
// Clean tutorial example program.
//
// This program can be used to test the different ControlAttributes for a 
// ButtonControl in a Dialog.
// ********************************************************************************
import StdEnv, StdIO
Start :: *World -> *World
Start world
# (id, world) = openId world 
# buttons = [
        ButtonControl "Function"        [ControlFunction (count 1 id)],
        ButtonControl "Hide"            [ControlHide],
        ButtonControl "Id + Width"      [ControlId id, ControlWidth (PixelWidth 250)],
        ButtonControl "ModsFunction"    [ControlModsFunction (modf id)],
        ButtonControl "Pos"             [ControlPos (Left, zero)],
        ButtonControl "SelectState"     [ControlSelectState Able],
        ButtonControl "SelectState"     [ControlSelectState Unable],
        ButtonControl "Tip"             [ControlTip "Some tip"],
        ButtonControl "Width"           [ControlWidth (PixelWidth 250)]
    ]
# controls = ListLS buttons
# dialog = Dialog "Support - ButtonControl" controls [WindowClose (noLS closeProcess)]
= startIO NDI Void (initialise dialog) [] world
where
    initialise dialog pst
    # (error,pst)       = openDialog 0 dialog pst
    | error <> NoError  = closeProcess pst
    | otherwise         = pst
    count :: Int Id (Int, PSt .l) -> (Int, PSt .l)
    count dx id (count,pst=:{io}) = (count + dx, appPIO (setControlText id (toString (count+dx))) pst)
    modf :: Id Modifiers -> (Int, PSt .l) -> (Int, PSt .l)
    modf id mods = \(count,pst=:{io}) . (count, appPIO (setControlText id (toString mods)) pst)
 
  |