[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Menus in Dr.Scheme



Title: Re: Menus in Dr.Scheme
At 4:28 PM -0500 11/19/01, Thierry Bouchard wrote:
HI everyone.We gotta do a small video games in a Scheme course and I'm trying to implement menus in our application. But I got a problem when it comes to make a menu-item object.I need a "callback procedure" as an argument for making the object but I dunno what it is and how to make one.Anyone has an idea?

Each menu item has a single callback procedure associated with it. When the user selects a menu item, MrEd calls the corresponding callback procedure.  Your program is not notified in any other way that the user has selected a menu item.

So, let's say I want to create a menu item called "beep now" that beeps when the user selects it.  I might create it like this:

(define my-menu-item (make-object menu-item% "beep now" my-menu-bar (lambda (a b) (bell))))

john clements

PS.: the built-in documentation, Help Desk, explains this quite well.  If you have access to this documentation, I would encourage you to use it.