Commit 35bb2114 authored by Bas Lijnse's avatar Bas Lijnse
Browse files

Added a RefreshTimer type which refreshes the iData in which it is placed after n milliseconds

parent fc22ada9
......@@ -6,13 +6,13 @@ definition module iDataButtons
import iDataHandler
import GenLexOrd
derive gForm (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
derive gUpd (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
derive gerda (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox
derive read (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox
derive write (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox
derive gForm (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive gUpd (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive gerda (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, HTML, PasswordBox, RefreshTimer
derive read (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox, RefreshTimer
derive write (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox, RefreshTimer
instance toBool CheckBox, Button, RadioButton // True if checkbox checked, button pressed
instance toInt PullDownMenu // Current index in pull down list
......@@ -67,4 +67,7 @@ instance - HtmlTime
:: HtmlDate = Date Int Int Int // Day Month Year
:: HtmlTime = Time Int Int Int // Hours Minutes Seconds
:: RefreshTimer = RefreshTimer Int // The editor for this type refreshes it's form after n milliseconds
getTimeAndDate :: !*HSt -> *(!(!HtmlTime,!HtmlDate),!*HSt)
......@@ -3,12 +3,13 @@ implementation module iDataButtons
import StdFunc, StdList, StdString, StdArray
import iDataFormlib, iDataHandler, iDataStylelib, iDataTrivial, StdBimap
derive gUpd (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode/*, Button, CheckBox*/, RadioButton /*, PullDownMenu, TextInput , TextArea, PasswordBox*/
derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox
derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox
derive gerda (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox
derive read (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox
derive write (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox
derive gPrint (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox, RefreshTimer
derive gParse (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox, RefreshTimer
derive gerda (,), (,,), (,,,), (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox, RefreshTimer
derive read (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox, RefreshTimer
derive write (<->), <|>, HtmlDate, HtmlTime, DisplayMode, Button, CheckBox, RadioButton, RadioGroup, PullDownMenu, TextInput, TextArea, PasswordBox, RefreshTimer
/*
:: TextInput = TI Int Int // Input box of size Size for Integers
......@@ -325,7 +326,6 @@ where
,incrHSt 1 hst)
= ( EmptyBody,incrHSt 1 hst )
// time and date
import StdTime
......@@ -367,6 +367,17 @@ where
fromPullDown (dv,mv,yv) = Date (convert dv) (convert mv) (convert yv)
where
convert x = toInt (toString x)
gForm {|RefreshTimer|} (init,formid) hst = case formid.ival of
RefreshTimer timeout
# (cntr,hst) = CntrHSt hst
# triplet = encodeTriplet (formid.id,cntr,UpdS "timer")
# inputid = encodeInputId (formid.id,cntr,UpdS "timer")
# timedcode = "toClean(document.getElementById('" +++ inputid +++ "'),'" +++ triplet +++ "',true,false," +++ (IF_ClientTasks "true" "false") +++ ");"
# script = [InlineCode ("<input type=\"hidden\" id=\""+++ inputid +++"\" /><script type=\"text/javascript\">setTimeout(\"" +++ timedcode +++ "\"," +++ toString timeout +++ ");</script>")]
= ({ changed = False, value = formid.ival, form = script}, incrHSt 1 hst)
// Updates that have to be treated specially:
......@@ -405,6 +416,12 @@ gUpd{|PasswordBox|} (UpdSearch val cnt) b = (UpdSearch val (cnt - 2),b
gUpd{|PasswordBox|} (UpdCreate l) _ = (UpdCreate l, PasswordBox "") // create default value
gUpd{|PasswordBox|} mode b = (mode, b) // don't change
gUpd{|RefreshTimer|} (UpdSearch (UpdS name) 0) v = (UpdDone, v) // We don't update
gUpd{|RefreshTimer|} (UpdSearch val cnt) v = (UpdSearch val (cnt - 1),v) // continue search, don't change
gUpd{|RefreshTimer|} (UpdCreate l) _ = (UpdCreate l, RefreshTimer 0) // create default value
gUpd{|RefreshTimer|} mode v = (mode, v) // don't change
// small utility stuf
instance toBool RadioButton where
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment