Path: utzoo!utgpu!watmath!att!tut.cis.ohio-state.edu!rutgers!sun-barr!cs.utexas.edu!uunet!mcvax!sunic!liuida!isy!news From: ingemar@isy.liu.se (Ingemar Ragnemalm) Newsgroups: comp.sys.mac.programmer Subject: Re: Real Multifinder Message-ID: <1989Aug17.095308.9564@isy.liu.se> Date: 17 Aug 89 09:53:08 GMT References: <46100321@uxe.cso.uiuc.edu> <1989Aug15.001507.14552@sj.ate.slb.com>\ <24626@iuvax.cs.indiana.edu> <3576@internal.Apple.COM> <1989Aug16.175747.24394@sj.ate.slb.com> Sender: news@isy.liu.se (Lord of the News) Organization: Dept of EE, University of Linkoping Lines: 38 enk@corona (Edan Kabatchnik) writes: > Granted, (parts of) UNIX should be done away with. But, there is a >superior form to the main event loop: callbacks (found in X and Xerox >Artificial Intelligence Workstations from which the Macintosh developed its >user interface.) Instead of having to dispatch on every possible event in the >main event loop, one establishes a hook that is automatically called when an >event takes place. > Example: when creating a menu, each item that can be selected > in the menu is given the address of the function which should > be called when that item is selected. > So, the programmer does not call his menu handler explicitly; rather, it >is "magically" called by the menu code in the toolbox when the selection >occurs. This takes away all the pains of the main event loop. (The main event >loop is reduced to a few standard lines of code that need not dispatch on >event.) > So much code has been written for the Macintosh which works without >callbacks, making it unlikely that future versions of the system will take >advantage of callbacks. But, if Apple could figure out a way of making both >systems work, then future programmers would be spared a great deal of pain. From the programmers point of wiew, TransSkel (by Paul duBois) does just that. For each menu and each window etc, a ProcPtr is installed, telling TransSkel what to call when that particular item gets a particular event. A similar (more limited) package is SimpleTools by Erik Kilk, and there are others as well. So, the problem is solved, I think. Ingemar Ragnemalm -- Dept. of Electrical Engineering ...!uunet!mcvax!enea!rainier!ingemar .. University of Linkoping, Sweden ingemar@isy.liu.se