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
|
module support_popup
import StdEnv, StdIO
Start :: *World -> *World
Start world
# (textid, world) = openId world
# popups = let w = PixelWidth 200 in [
PopUpControl [("Activate " +++ toString i, id) \\ i <- [1..5]] 1 [ControlActivate (count 1 textid)], // doesn't work yet
PopUpControl [("Deactivate " +++ toString i, id) \\ i <- [1..5]] 2 [ControlDeactivate (count -1 textid)], // doesn't work yet
PopUpControl [("Hide " +++ toString i, id) \\ i <- [1..5]] 1 [ControlHide],
PopUpControl [("Id " +++ toString i, id) \\ i <- [1..5]] 3 [], // todo
PopUpControl [("Pos " +++ toString i, id) \\ i <- [1..5]] 4 [ControlPos (Left, zero)],
PopUpControl [("SelectState " +++ toString i, id) \\ i <- [1..5]] 5 [ControlSelectState Able],
PopUpControl [("SelectState " +++ toString i, id) \\ i <- [1..5]] 1 [ControlSelectState Unable],
PopUpControl [("Tip " +++ toString i, id) \\ i <- [1..5]] 2 [ControlTip "Some tip"],
PopUpControl [("Width " +++ toString i, id) \\ i <- [1..5]] 3 [ControlWidth (PixelWidth 500)]
]
# controls = ButtonControl "For callbacks" [ControlId textid] :+: ListLS popups
# dialog = Dialog "Support - PopUpControl" controls [WindowClose (noLS closeProcess), WindowViewSize {w=1000,h=500}] // because vertical space isn't reserved properly
= 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)
|