langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
|
|
@ -0,0 +1,42 @@
|
|||
declare
|
||||
[QTk] = {Module.link ['x-oz://system/wp/QTk.ozf']}
|
||||
|
||||
proc {Main}
|
||||
MaxValue = 1000
|
||||
NumberWidget
|
||||
GUI = lr(
|
||||
numberentry(init:1 min:0 max:MaxValue handle:NumberWidget)
|
||||
button(text:"Increase"
|
||||
action:proc {$}
|
||||
OldVal = {NumberWidget get($)}
|
||||
in
|
||||
{NumberWidget set(OldVal+1)}
|
||||
end)
|
||||
button(text:"Random"
|
||||
action:proc {$}
|
||||
if {Ask "Reset to random?"} then
|
||||
Rnd = {OS.rand} * MaxValue div {OS.randLimits _}
|
||||
in
|
||||
{NumberWidget set(Rnd)}
|
||||
end
|
||||
end)
|
||||
)
|
||||
Window = {QTk.build GUI}
|
||||
in
|
||||
{Window show}
|
||||
end
|
||||
|
||||
fun {Ask Msg}
|
||||
Result
|
||||
Box = {QTk.build
|
||||
td(message(init:Msg)
|
||||
lr(button(text:"Yes" action:proc {$} Result=true {Box close} end)
|
||||
button(text:"No" action:proc {$} Result=false {Box close} end)
|
||||
))}
|
||||
in
|
||||
{Box show}
|
||||
{Box wait}
|
||||
Result
|
||||
end
|
||||
in
|
||||
{Main}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
declare
|
||||
[Roads] = {Module.link ['x-ozlib://wmeyer/roads/Roads.ozf']}
|
||||
|
||||
MaxValue = 1000
|
||||
|
||||
fun {Start Session}
|
||||
{Page 0}
|
||||
end
|
||||
|
||||
fun {Page Val}
|
||||
html(
|
||||
body(
|
||||
%% numerical input with an HTML form
|
||||
local NewVal in
|
||||
form(
|
||||
{NumberInput Val NewVal}
|
||||
input(type:submit)
|
||||
method:post
|
||||
action:fun {$ _}
|
||||
{Page NewVal}
|
||||
end
|
||||
)
|
||||
end
|
||||
%% link with button functionality
|
||||
a("Increase"
|
||||
href:fun {$ _}
|
||||
{Page Val+1}
|
||||
end)
|
||||
" "
|
||||
%% another "button-link"
|
||||
a("Random"
|
||||
href:fun {$ S}
|
||||
p("Reset to random? - "
|
||||
a("Yes" href:fun {$ _}
|
||||
Rnd = {OS.rand} * MaxValue div {OS.randLimits _}
|
||||
in
|
||||
{Page Rnd}
|
||||
end)
|
||||
" "
|
||||
a("No" href:fun {$ _} {Page Val} end)
|
||||
)
|
||||
end)
|
||||
))
|
||||
end
|
||||
|
||||
%% a "formlet", managing input of an integer value
|
||||
fun {NumberInput OldVal NewVal}
|
||||
input(type:text
|
||||
validate:int_in(0 MaxValue)
|
||||
value:{Int.toString OldVal}
|
||||
bind:proc {$ Str} NewVal = {String.toInt Str.escaped} end
|
||||
)
|
||||
end
|
||||
in
|
||||
{Roads.registerFunction 'start' Start}
|
||||
{Roads.run}
|
||||
Loading…
Add table
Add a link
Reference in a new issue