Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!swbatl!uucibg From: uucibg@swbatl.UUCP (3929) Newsgroups: comp.sys.mac.programmer Subject: Events and classes (OO-stuff) Keywords: events, sub-classing, things popping out of nowhere Message-ID: <817@swbatl.UUCP> Date: 26 Sep 89 02:15:20 GMT Organization: Southwestern Bell Tele. Co. - Advanced Technology Lab - St. Louis Lines: 37 Please forgive if this has been talked to death previously (in which case I'd appreciate it if someone could fill me in on the results)... How does one go about handling things like events object-orientedly? It is kind of a problem in the sense that you've got these different kinds of events popping out of "nowhere" (from the OS event queue). I've used the rule of thumb "if you consider using a case statement, then it ought to be a method/member function in a bunch of classes". This would seem to argue something like: Event | +-----------------+--------+------------+-------------+ | | | | KeyEvent WindowEvent MouseEvent DiskEvent ... ... ... ... But now what beast does one's program get one of these from? Does one create an "EventQueue" class or some such thing whose "new" method/member function returns instance of different classes (some sub-class of Event) or some such thing? How does MacApp handle this? What other approaches are there? Thanks much, -------------------------------------------------------------------------------- Brian R. Gilstrap ...!{ {killer,bellcore}!texbell, uunet }!swbatl!uucibg One Bell Center +---------------------------------------------------------- Rm 17-G-4 | "Winnie-the-Pooh read the two notices very carefully, St. Louis, MO 63101 | first from left to right, and afterwards, in case he had (314) 235-3929 | missed some of it, from right to left." -- A. A. Milne -------------------------------------------------------------------------------- Disclaimer: Me, speak for my company? You must be joking. I'm just speaking my mind.