Mercurial > repos > rhope
view calc.rhope @ 120:cd25171e1bb2
Use List for Subsets instead of a Dictionary for performance reasons. Fix issue with List literals. Compiled compiler is now self-hosting.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 21 Oct 2010 23:55:15 -0400 |
parents | 76568becd6d6 |
children |
line wrap: on
line source
/* This program implements a simple GUI calculator Currently only the Windows and Syllable ports of Rhope have GUI support */ Add[window] { [window]Get Value["right"] { <String@Real Number[~] { [window]Set Value["left", [~] + [[window]Get Value["left"]]] [window]Set Value["right", "0"] } } } Sub[window] { [window]Get Value["right"] { [window]Set Value["left", [<String@Real Number[ [window]Get Value["left"] ]] - [~]] [window]Set Value["right", "0"] } } Main[] { [[[[[[New@Window["Visuality Calculator", 400.0, 400.0] ]Add Widget["+", [New@Button["+", 20.0, 20.0]]Set Handler["click","Add"], 20.0, 60.0] ]Add Widget["-", [New@Button["-", 20.0, 20.0]]Set Handler["click","Sub"], 60.0, 60.0] ]Add Widget["left", [New@Input Box["0", 170.0, 20.0]]Set Type["numeric"], 20.0, 20.0] ]Add Widget["right", [New@Input Box["0", 170.0, 20.0]]Set Type["numeric"], 210.0, 20.0] ]Show[20.0,20.0] ]Wait Close }