[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Interaction between buttons
- To: info-mcl@cambridge.apple.com
- Subject: Interaction between buttons
- From: jipan@gmuvax2.gmu.edu (Jiqian Pan)
- Date: Thu, 5 Mar 92 17:34:19 -0500
- Cc: jipan@gmuvax2.gmu.edu
I has been designing some code for timing with two buttons go and stop.
Once you click the button go, timing will start; once you click the
button stop, timing should stop. However, the button stop did not
work while timing is going. Does anyone fix my problems? Thanks.
(setq foo (make-instance 'window
:window-type :document-with-zoom
:view-position '(:Top 150)
:window-title "FLUENT-II"
:view-size #@(400 300)
:view-nick-name 'button-dialog
:view-subviews
(list
(make-dialog-item 'button-dialog-item
#@(300 250)
#@(30 15) "go"
#'(lambda (item) item (clock-my))
:view-font '("Times" 12 :SRCCOPY :bold ))
(make-dialog-item 'button-dialog-item
#@(350 250)
#@(30 15) "stop"
#'(lambda (item) item (setq timing "false"))
:view-font '("Times" 14 :SRCCOPY :bold )))))
(defun clock-my()
(setq timing "true")
(setq x-pos 250) (setq y-pos 100)
( dotimes (i 32)
(move-to foo (make-point 250 150))
(line-to foo (make-point x-pos y-pos))(delay-1)
(if (equal timing "false")(return))
(set-pen-pattern foo *white-pattern*)(move-to foo (make-point 250 150))
(line-to foo (make-point x-pos y-pos))
(cond ((<= i 15)
(setq x-pos (+ 250 (round (* (sin (* PI (/ (* 12 i) 180))) 50))))
(setq y-pos (- 150 (round (* (cos (* PI (/ (* 12 i) 180))) 50)))))
(t (setq x-pos (- 250 (round (* (sin (* PI (/ (* 12 (- i 15)) 180))) 50))))
(setq y-pos (+ 150 (round (* (cos (* PI (/ (* 12 (- i 15)) 180))) 50))))))
(set-pen-pattern foo *black-pattern*)
))
(defun delay-1 ()
(dotimes (i 123456)
(* 123456789 987654321)))
jipan@gmuvax2.gmu.edu