I tried to make a calculator, it's very simple and I don't think it has got any bugs.. try it and tell me
You type /static.calc to open it
dialog staticcalc {
title "StaticX__'s Calculator"
size -1 -1 240 175
option pixels notheme
button "+", 1, 69 52 23 16
button "-", 2, 94 52 23 16
button "*", 3, 119 52 23 16
button "/", 4, 144 52 23 16
edit "", 5, 37 30 164 20, autohs limit 20
edit "", 6, 37 91 164 20, autohs limit 20
text "1st number", 7, 36 11 100 17
text "2nd number", 8, 37 72 100 17
edit "", 9, 37 130 164 20, read autohs limit 20
text "Result", 10, 37 111 100 17
}
on *:DIALOG:staticcalc:sclick:*:{
did -ra $dname 9 $calc($did(5) $did($did).text $did(6))
}
alias static.calc { dialog -m staticcalc staticcalc }
alias static.calc dialog $+(-,$iif($dialog(staticcalc),v,m staticcalc)) staticcalc
on *:DIALOG:staticcalc:sclick:*:{
if ($did = 1) did -ra $dname 9 $calc($did(5) + $did(6))
if ($did = 2) did -ra $dname 9 $calc($did(5) - $did(6))
if ($did = 3) did -ra $dname 9 $calc($did(5) * $did(6))
if ($did = 4) did -ra $dname 9 $calc($did(5) / $did(6))
}
This would shorten your code a-lot. :)