I have also compiled some notes on Dr Scheme, in an attempt to get my little brother to do something besides play Runescape. I know these are incomplete, but here they are just the same:
http://download.plt-shceme.org/doc/208/hmtl/mred/index.htm
Notes on Mr. Ed relevant to my work: (Section One)
Create a Frame:
(define frame (instantiate frame% (“Example)))
frame: anything, this is variable X
Anything with % cannot be replaced with something else unless otherwise noted.
In this case, that means frame% must be copied exactly. “Example can be replaced with up to 200 characters of text.
Create a Message:
(define msg (instantiate message% (“example frame)))
msg: anything, this is variable Y
“example is the message itself, and frame is variable X.
Create a Button with reaction:
(instantiate button% () (label “click me)(parent frame)
label is the buttons label, and frame is variable X.
(callback (lambda (button event)(send msg set-label “button click))))
The above line of code must be copied exactly, except msg is variable Y, set-label can be a different command, and msg can be replaced with something like variable X followed by the show command. (send frame show #t) will make the frame visible to the user. A callback must be immediately after the button it was made for.
Full Simple Program:
(define frame (instantiate frame% (“Example)))
(define msg (instantiate message% (“example frame)))
(instantiate button% () (label “click me)(parent frame)
(callback (lambda (button event)(send msg set-label “button click))))
This will cause a window to appear on screen. It will be titled example, have the word example inside it, and if you click the click me button, the word example will become the wrods button click.
Scheme Notes: (Section Two)
Multiple Button Events:
A callback can have multiple effects on a program by adding send commands: Example:
(define frame (instantiate frame% (“Example)))
(define msg (instantiate message% (“example frame)))
(instantiate button% () (label “click me)(parent frame)
(callback (lambda (button event)(send msg set-label “button click))))
If you change the fourth line of code to this:
(callback (lambda (button event)(send msg set-label “button click) (send frame show #f))))
Then after displaying the message, the window will disappear. Problem is, you will not be able to read the message.
I will update these whenever I create a new section, or end a section that cuts out in the middle.