summaryrefslogtreecommitdiffstats
path: root/demo2.tl
diff options
context:
space:
mode:
Diffstat (limited to 'demo2.tl')
-rwxr-xr-xdemo2.tl29
1 files changed, 29 insertions, 0 deletions
diff --git a/demo2.tl b/demo2.tl
new file mode 100755
index 0000000..cd757ce
--- /dev/null
+++ b/demo2.tl
@@ -0,0 +1,29 @@
+; Refer to the demostuff file for definitions and descriptions.
+
+(defun demo2 ()
+ (window demo2 demos "Numerals Demo" 250 250)
+ (box h outerbox2 demo2)
+ (box v mainbox2 outerbox2)
+ (box h numbox2 mainbox2)
+ (button b21 (bnt 1) mainbox2 (xnum (bn 1)))
+ (button b22 (bnt 2) mainbox2 (xnum (bn 2)))
+ (button b23 (bnt 3) mainbox2 (xnum (bn 3)))
+ (button b24 (bnt 4) mainbox2 (xnum (bn 4)))
+ (button b25 (bnt 5) mainbox2 (xnum (bn 5)))
+ (button numeralbutton2 "Numerals" mainbox2 (togglenumar))
+ (text num2 "zero" numbox2)
+ (gtk_widget_show_all demo2))
+
+(defparameter numar 'a) ; 'r = I II II IV V. 'a = 1 2 3 4 5.
+
+; Button number (bn) and button number text (bnt):
+(defun bn (n) (nth (pred n) '(11 22 33 44 55)))
+(defun bnt (n) (format nil (if (eq numar 'a) "~d" "~@R") (bn n)))
+
+(defun togglenumar ()
+ (set numar (if (eq numar 'a) 'r 'a))
+ (each ((button (list b21 b22 b23 b24 b25))
+ (n (range 1 5)))
+ (xlabel button (bnt n))))
+
+(defun xnum (n) (xtext num2 (format nil "~R" n)))