[comp.sys.mac.programmer] any simple WDEF examples out there?

fleabag@athena.mit.edu (jeff bellsey) (11/08/90)

are there any programming examples of custom WDEF's?  mine works
well enough that i can tell i'm on the right track, but not well
enough to be usable.  

any pointers would be *much* appreciated.

thanks...
:jeff
fleabag@athena.mit.edu

oster@well.sf.ca.us (David Phillip Oster) (11/10/90)

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

jtt@cunixd.cc.columbia.edu (James T. Tanis) (11/10/90)

Code for a simple WDEF (and a very nice one, I might add) is available with
think C 4.0. I think it's in the Art Class projecty, and it's called
windoid.WDEF or some such thing.

Also, does anyone know the author of th 'shrinker' WDEF? It is included in
the winchooser package from sumex. I like his WDEF, but it has a few tiny
bugs that make it unusable...

-JT