The GUI teachpack

The GUI teachpack - (define x (make-object text-field%...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
(module makegui-teachpack mzscheme (require (lib "compat.ss") (lib "etc.ss") (lib "class.ss") (lib "mred.ss" "mred")) (provide make-gui) (define (make-gui title button-descr callback) (local [(define BUT-SIZE 10) (define WIDTH (* 2 BUT-SIZE)) (define HEIGHT BUT-SIZE) (define frame (make-object frame% title #f WIDTH HEIGHT)) (define main-panel (make-object vertical-panel% frame)) (define (make-named-text label) (local ((define p (make-object horizontal-panel% main-panel)) (define t (make-object message% label p))
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: (define x (make-object text-field% "" p void ""))) x)) (define Input1 (make-named-text "Input 1")) (define Input2 (make-named-text "Input 2")) (define calc-button (make-object button% button-descr main-panel (lambda _ (local [(define result (callback (string->number (send Input1 get-value)) (string->number (send Input2 get-value))))] (send output set-value (format "~a" result)))))) (define output (make-named-text "Output"))] (send frame show #t))) )...
View Full Document

This note was uploaded on 02/06/2008 for the course CS 1102 taught by Professor Fisler during the Fall '07 term at WPI.

Ask a homework question - tutors are online