Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!sun-barr!apple!well!oster From: oster@well.sf.ca.us (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: Re: any simple WDEF examples out there? Message-ID: <21592@well.sf.ca.us> Date: 10 Nov 90 09:11:05 GMT References: <1990Nov7.190558.8018@athena.mit.edu> Organization: Whole Earth 'Lectronic Link, Sausalito, CA Lines: 23 By coincidence, I was just writing a WDEF last week. I won't give you my code (unless you buy it at my consulting rates :-) but I will give you some advice: 1.) You're WDEF will be called by multifinder during "minor swaps" therefore, if it uses any globals (including quickdraw globals like "black") it must save A5 on entry, point at your globals, and restore A5 on exit. 2.) Every time your WDEF is called, the current port is the Window manager port. Except when you are called due to a minor swap in multifinder. Then, the port is the current window itself. useless for drawing window frames. Best save the grafport, set it to the window manager port, do your drawing, and restore the grafport on exit. 3.) if you use a pattern, you must manually align the pattern so that if the user moves the window by 1 pixel, then causes an update to a portion of the window frame, that there is no tearing at the update line. 4.) The THINK C debugger can not be used to debug a WDEF: the hiliting and dehiliting of your window as the debugger becomes active and deactive confuses the debugger. Better print out a listing and work in macsbug. 5.) Keep hunting. simple WDEF source code is out there. -- -- David Phillip Oster - Note new signature. Old one has gone Bye Bye. -- oster@well.sf.ca.us = {backbone}!well!oster