[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Event handling
- To: email@example.com (Macintosh Common Lisp)
- Subject: Re: Event handling
- From: firstname.lastname@example.org (Guillaume Cartier)
- Date: Wed, 15 Jan 92 17:47:30 -0500
>I just wrote a simple program for event handling as follows:
>(defclass my-window (window)() )
> ((window my-window) where)
> (print (point-string where)))
> (make-instance 'my-window))
> ;system should wait for events from the user
> (print "ok"))
>After running the function toy, the system creates not only a window,
>but also shows the "ok" in the Listener. My purpose of the program
>is to first create a window, then wait for events from the user, and
>finally print the "ok" in the Listener. Can anyone fix my problem?
>Thanks in advance.
Everything should be clear if you understand the model of event handling
MCL uses (see the section Events in the docs).
As a very trivial example of events handling for a chess program:
(defmethod view-click-EVENT-HANDLER ; all the handling of events relative
((window chess-window) where) ; to the window has to be done in here
(multiple-value-bind (h v)
(if (or (< h 0) (> h 7)
(< v 0) (> v 7))
(play-the-chess-move window h v))))
If fact, dialog items that you could put on your window, are just more
specialized ways of handling window events.
Hope this makes sense.
LACIM, Universite du Quebec a Montreal.
Bureau: (514) 987-4290