Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csmil.umich.edu From: cash@csmil.umich.edu (Howard Cash) Newsgroups: comp.sys.mac.programmer Subject: Where to put window handling routines Message-ID: <1067@mailrus.cc.umich.edu> Date: 9 May 89 04:29:17 GMT Sender: usenet@mailrus.cc.umich.edu Reply-To: cash@csmil.umich.edu (Howard Cash) Organization: Cognitive Science and Machine Intelligence Laboratory Lines: 28 've been looking through some C code for the Mac, and I've noticed two fundamentally different philosophies on the management of window events. I want some votes on the prefered methodology. Both cases use a struct of function pointers that handle various events in the window (keyboard, mousedown, update, etc). CASE 1: The event handling struct is the first field in a bigger struct that includes window data. A handle to the whole thing is in the window's RefCon so an event in the window looks in the RefCon for the appropriate handling function. The RefCon ends up pointing to a fairly bulky structure, but you always know where to find relevant functions or data. CASE 2: The handling struct includes a window pointer to the window being handled. A list of such structs is maintained. When the event arises, the list is searched for a "Window Handler" struct whose windowPtr field is the same as the window where the event occurred. This takes some search time, but the RefCon is free to carry only window-specific DATA and theJ management functions are isolated elsewhere. How do all you experienced mac programmers deal with this issue? Howard Cash cash@csmil.umich.edu This posting contains no opinions.