Mercurial > repos > rhope
comparison calc.rhope @ 0:76568becd6d6
Rhope Alpha 2a source import
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 28 Apr 2009 23:06:07 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:76568becd6d6 |
---|---|
1 /* | |
2 This program implements a simple GUI calculator | |
3 Currently only the Windows and Syllable ports of Rhope have GUI support | |
4 */ | |
5 | |
6 | |
7 Add[window] | |
8 { | |
9 [window]Get Value["right"] | |
10 { | |
11 <String@Real Number[~] | |
12 { | |
13 [window]Set Value["left", [~] + [[window]Get Value["left"]]] | |
14 [window]Set Value["right", "0"] | |
15 } | |
16 } | |
17 } | |
18 | |
19 Sub[window] | |
20 { | |
21 [window]Get Value["right"] | |
22 { | |
23 [window]Set Value["left", [<String@Real Number[ [window]Get Value["left"] ]] - [~]] | |
24 [window]Set Value["right", "0"] | |
25 } | |
26 } | |
27 | |
28 Main[] | |
29 { | |
30 [[[[[[New@Window["Visuality Calculator", 400.0, 400.0] | |
31 ]Add Widget["+", [New@Button["+", 20.0, 20.0]]Set Handler["click","Add"], 20.0, 60.0] | |
32 ]Add Widget["-", [New@Button["-", 20.0, 20.0]]Set Handler["click","Sub"], 60.0, 60.0] | |
33 ]Add Widget["left", [New@Input Box["0", 170.0, 20.0]]Set Type["numeric"], 20.0, 20.0] | |
34 ]Add Widget["right", [New@Input Box["0", 170.0, 20.0]]Set Type["numeric"], 210.0, 20.0] | |
35 ]Show[20.0,20.0] | |
36 ]Wait Close | |
37 } |