; A button made this way works as I would expect, it waits for 30 minutes and then shows a message-box and plays a sound.(new button% [parent long-break-panel] [label "Long Break"] ; Callback procedure for a button click: [callback (lambda (button event) (send long-break-msg set-label "Long break timer started") (general-timer 30 long-break-callback))])
; A button made this way immediately shows the message box and plays the sound.(new button% [parent long-break-panel] [label "Long Break"] ; Callback procedure for a button click: [callback (lambda (button event) (send long-break-msg set-label "Long break timer started") (general-timer 30 (general-callback long-break-msg "Not on long break" "30 Minutes have passed, back to work.")))])
; A button made this way also immediately shows the message box and plays the sound. Why is it different when the function name is surrounded by parentheses?(new button% [parent long-break-panel] [label "Long Break"] ; Callback procedure for a button click: [callback (lambda (button event) (send long-break-msg set-label "Long break timer started") (general-timer 30 (long-break-callback)))])
; The documentation for buttons say they require a callback. I interpreted this to mean a function that will execute when the button is clicked.
(define general-callback (lambda (msg-name msg-text message-box-text) (time-expired-sound) (send msg-name set-label msg-text) (message-box "Timer expired" message-box-text frame)))
; Why does wrapping the function so that it takes no parameters change how it gets executed?
(define long-break-callback (lambda () (general-callback long-break-msg "Not on long break" "30 Minutes have passed, back to work.")))
> To unsubscribe from this group and stop receiving emails from it, send an email to racket...@googlegroups.com.
; Make a button in the frame(new button% [parent work-panel] [label "Work"]
; Callback procedure for a button click: [callback (lambda (button event)
(send work-msg set-label "Work timer started") (make-timer 25 (lambda () (timer-callback work-msg "Not working" "25 Minutes have passed, take a break."))))])