[comp.sys.mac.programmer] Window classes

dorsett@molokai.sw.mcc.com (Robert Dorsett) (06/15/89)

What is Apple policy on using the WindowKind field of a window record to
store information on application window classes?  IM V. I only says that TWO
classes are defined, yet reserves an entire word for the function.

oster@dewey.soe.berkeley.edu (David Phillip Oster) (06/15/89)

Inside Mac vol 1. says: the window kind holds the refNum of d.a. windows
(that aren't dialogs.) It also says the application may store integers >=
userkind into the windowKind field.  I use it this way as one way of
telling my windows from other windows, and telling them apart. Note, the
d.a. version means that you can implement a menu command "close" that will
close not only your windows, but also desk accessory windows: (send them a
CloseDeskAcc( (((WindowPeek) FrontWindow())->windowKind);  ).

tim@hoptoad.uucp (Tim Maroney) (06/15/89)

In article <2480@molokai.sw.mcc.com> dorsett@molokai.sw.mcc.com (Robert Dorsett) writes:
>What is Apple policy on using the WindowKind field of a window record to
>store information on application window classes?  IM V. I only says that TWO
>classes are defined, yet reserves an entire word for the function.

Actually, IM page I-276 says that application windows can be any value
eight or greater.  This can be useful, but it's usually more useful to
store a handle to a relocatable data structure in the refCon field
instead.  Still, there's nothing wrong with storing some kind of window
type information in the windowKind.

Values 0 through 7 are reserved, and all the negative values are
reserved for desk accessory windows.  So be sure you only use 8+.
-- 
Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com
Postal: 424 Tehama, SF CA 94103; Phone: (415) 495-2934

"The negro slaves of the South are the happiest, and, in some sense, the
 freest people in the world.  The children and the aged and infirm work not
 at all, and yet have all the comforts and neccessaries of life provided for
 them." -- George Fitzhugh, CANNIBALS ALL! OR, SLAVES WITHOUT MASTERS, 1857

wdh@well.UUCP (Bill Hofmann) (06/15/89)

In article <2480@molokai.sw.mcc.com> dorsett@molokai.sw.mcc.com (Robert Dorsett) writes:
>What is Apple policy on using the WindowKind field of a window record to
>store information on application window classes?  IM V. I only says that TWO
>classes are defined, yet reserves an entire word for the function.
I don't know what Apple policy is, but here's my understanding:
If you want the Desk Manager to deal with a DA window properly, you have
to put the negative refNum into the windowKind field (actually, -(refNum+1)).
If you want the Dialog Manager to deal with a window properly, you have
to put dialogKind (2) into the windowKind field (this is done automatically
by NewDialog).  Thus, if you have a DA window which you use dialog manager
calls on occasionally, you'll have to swap windowKinds.

Other than that, there's no restriction on the use of windowKind.  I use
it to identify various kinds of windows, and find it rather handy.  There's
no programmatic interface, and I've never found anything that depends on
the windowKind being userKind (8).

-Bill Hofmann