Mercurial > gui
comparison datebox.ur @ 23:7c734edc6301
Merge from Adam.
author | Karn Kallio <kkallio@eka> |
---|---|
date | Sat, 24 Sep 2011 18:55:27 -0430 |
parents | 554e342665fe |
children | 5905b56e0cd9 |
comparison
equal
deleted
inserted
replaced
22:4362b15220e4 | 23:7c734edc6301 |
---|---|
1 type t = {Cal : Calendar.t, | 1 type t = {Cal : Calendar.t, |
2 Panel : TogglePanel.togglePanel Calendar.t} | 2 Panel : TogglePanel.togglePanel Calendar.t []} |
3 | 3 |
4 type date = Calendar.date | 4 type date = Calendar.date |
5 val date_eq = Calendar.date_eq | 5 val date_eq = Calendar.date_eq |
6 val date_ord = Calendar.date_ord | 6 val date_ord = Calendar.date_ord |
7 val time = Calendar.time | 7 val time = Calendar.time |
8 val date = Calendar.date | 8 val date = Calendar.date |
9 | 9 |
10 val format = TogglePanel.defaultFormat | 10 val format : TogglePanel.formatCtl [] = fn [body ~ []] => |
11 --#OpenCtl -- #CloseCtl | 11 TogglePanel.defaultFormat |
12 ++ {OpenCtl = fn behaviour => <xml><button value="Choose" onclick={behaviour}/></xml>, | 12 -- #OpenCtl -- #CloseCtl |
13 CloseCtl = fn behaviour => <xml><button value="Hide" onclick={behaviour}/></xml>} | 13 ++ {OpenCtl = fn behaviour => <xml><button value="Choose" onclick={behaviour}/></xml>, |
14 CloseCtl = fn behaviour => <xml><button value="Hide" onclick={behaviour}/></xml>} | |
14 | 15 |
15 fun create tm = | 16 fun create tm = |
16 cal <- Calendar.create tm; | 17 cal <- Calendar.create tm; |
17 panel <- TogglePanel.create format cal False; | 18 panel <- TogglePanel.create @format cal False; |
18 | 19 |
19 return {Cal = cal, | 20 return {Cal = cal, |
20 Panel = panel} | 21 Panel = panel} |
21 | 22 |
22 fun onChange db f = | 23 fun onChange db f = |
25 fun set db day = | 26 fun set db day = |
26 Calendar.set db.Cal day | 27 Calendar.set db.Cal day |
27 | 28 |
28 fun value db = Calendar.value db.Cal | 29 fun value db = Calendar.value db.Cal |
29 | 30 |
30 fun render db = | 31 val gui_t = Gui.mkGui (fn [body ~ []] db => |
31 <xml> | 32 <xml> |
32 <dyn signal={date <- Calendar.value db.Cal; | 33 <dyn signal={date <- Calendar.value db.Cal; |
33 return <xml>{[date.Year]}-{[date.Month]}-{[date.Day]}</xml>}/> | 34 return <xml>{[date.Year]}-{[date.Month]}-{[date.Day]}</xml>}/> |
34 {Gui.toXml db.Panel} | 35 {Gui.toXml db.Panel} |
35 </xml> | 36 </xml>) |