lsr@apple.UUCP (Larry Rosenstein) (12/01/84)
I want to solicit some input from the net community regarding Macintosh development techniques. I am working on a project at Apple that involves making Macintosh development much easier. The approach we are taking is similar to that used in the Lisa Toolkit (if anyone is familiar with that). Briefly, we are developing an Expandable Application that implements the standard Macintosh behavior (eg., printing, resizing/moving windows, handling desk accessories, etc.). Programmers make extensions to the Expandable Application to add specific behavior (eg., drawing an image in the window). What we try to do is figure out the best way to do a particular task (eg., scrolling), and implement it once in the Expandable Application where everyone can take advantage of it. I would like to hear: (1) any reactions you have to this idea, and (more importantly) (2) any helpful hints/tricks you have for implementing certain features or for debugging. The following techniques will give you an idea of what I mean (and might be useful in your own applications): (1) Instead of reading in the menus into a global array (like the FILE program does) use the GetMHandle trap, which takes in a menuID of a menu in the menu bar and returns the handle. (So far the Expandable Application has not had to access an item of a menu NOT in the menu bar.) (2) Calling EnableItem, CheckItem, etc. causes the menu to recompute its size each time, which takes some time. Before making these calls, replace the menuProc by a HANDLE to a dummy procedure that does nothing (but has the right interface). Afterwards, you restore the original menuProc and can call CalcMenuSize to compute the new menu size. (You can skip the call the CalcMenuSize if you are sure the menu didn't change size, which is usually the case.) (3) When moving the scroll bars (because the window changed size), don't call HideControl/ShowControl. Instead, set the clipping to a zero-sized rectangle. (Remember that you also need to invalidate the old and new positions of the grow box.) (4) When printing, send the spool file to the same volume as the document (since the program disk is likely to be full and/or write-protected). The volume used for the spool file is specified in the iFileVol field of the TPrJob record, which is described in the "Printing From Macintosh Applications" section of Inside Macintosh. I am interested in any comments you have. I hope that my mailbox can stand the strain! :-) Larry Rosenstein Apple Computer, Inc. CSNET: lsr%Apple@CSNET-RELAY UUCP: {nsc, dual, idi, voder}!apple!lsr