[comp.sys.mac.programmer] Defining your own windows

juana@dciem.dciem.dnd.ca (Juana Chang) (03/13/90)

I'm attempting (note the word attempting) to define a round window and IM
says to define your own type of window, you write a window definition and
store it in a resource file.

Question 1:  Is there a more detailed explaination on how to write a window
definition function than what's there on pages 298-299?

Question 2:  How do you store the function in a resource file? (Are there
any manuals for ResEdit?)

Question 3:  Can you use ResEdit to define your window without writing the
function and storing it into ResEdit?

Question 4:  Are there any manuals for ResEdit 1.2?

Sorry if the questions are too general but I'm only just learning the
Macintosh and Think C 4.0.

Would you please mail any replies to me.
Thanks for all the help!

Jim.Spencer@p5.f22.n282.z1.FIDONET.ORG (Jim Spencer) (03/15/90)

 >I'm attempting (note the word attempting) to define a round window and IM
 >says to define your own type of window, you write a window definition and
 >store it in a resource file.
 >
 >Question 1:  Is there a more detailed explaination on how to write a window
 >definition function than what's there on pages 298-299?
 >
 >Question 2:  How do you store the function in a resource file? (Are there
 >any manuals for ResEdit?)
 >
 >Question 3:  Can you use ResEdit to define your window without writing the
 >function and storing it into ResEdit?
 >
 >Question 4:  Are there any manuals for ResEdit 1.2?
 >
 >Sorry if the questions are too general but I'm only just learning the
 >Macintosh and Think C 4.0.
 >
 >Would you please mail any replies to me.
 >Thanks for all the help!

Answer 1: There's an article in the April '89 MacTutor showing a complete 
window defintion procedure that may be of some help.  I assume that it will 
be in Vol. 5 of the Best of whenever it is available.

Answer 2: When you link the procedure you do it as a WDEF resource type. 
In MPW this is done with something like:

Link -m WINDOWDEF -rt WDEF=256 -sn Main='myDefinitionName'....

followed by the files to be linked as well as the name of the file to be 
output to.  In Think Pascal, you simply set the Project Type to a pure code 
resource with a type of WDEF (I assume something similar is done in Think 
C).  In either case, the resource will be placed in the resource fork of 
your output file. You will only need to use ResEdit if you want to move it 
from that file to another.

Answer 3:  Don't confuse the window definition procedure, the WDEF resource 
(which is the actual code that draws a window of a particular type) and the 
WIND resource which is a template containing data for the window of a 
particular size.  Because you are trying trying to create a window type 
which does not already have a definition, you actually must write the code. 
The only way you can do this in ResEdit is by writing your code directly in 
hex.  Good luck if you take this approach! :)  The kinds of things you can 
create in ResEdit are non-code resources like menus (but again, not the 
menu definition procedure which contains the code to draw a particular menu 
type) or icons. You also can create a WIND window template graphically 
which can be used by the standard window definition procedures to define 
things like location, size, name, etc.

Answer 4:  There is a HyperCard stack around somewhere with ResEdit 
instructions or you can get a full blown 125 page manual through APDA.

--  
Jim Spencer - via FidoNet node 1:282/33
UUCP: ...!uunet!imagery!22.5!Jim.Spencer
ARPA: Jim.Spencer@p5.f22.n282.z1.FIDONET.ORG