Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!cs.utexas.edu!uunet!intercon!amanda@intercon.uu.net From: amanda@intercon.uu.net (Amanda Walker) Newsgroups: comp.sys.mac.programmer Subject: Re: Need help writing an LDEF Message-ID: <1143@intercon.UUCP> Date: 30 Jun 89 22:54:45 GMT References: <75580@pyramid.pyramid.com> Sender: news@intercon.UUCP Reply-To: amanda@intercon.uu.net (Amanda Walker) Organization: InterCon Systems Corporation Lines: 49 This is short enough that I'll just post it here. LDEFs are about the simplest kind of Mac code resources to write. Here's an LDEF that does the same thing as the default LDEF 0: (THINK C 3.0): ------------------------CUT HERE----------------------- /* Simple Custom LDEF Amanda Walker, InterCon Corporation 6 October 1988 This is a very simple custom LDEF. It acts just like LDEF 0. */ pascal void main(lMessage, lSelect, lRect, lCell, lDataOffset, lDataLen, lHandle) short lMessage; Boolean lSelect; Rect *lRect; Cell *lCell; short lDataOffset, lDataLen; ListHandle lHandle; { lMessage--; /* no initialization needed */ if (!lMessage--) { /* draw the cell */ MoveTo(lRect->left + 5, lRect->top + 12); HLock((**lHandle).cells); TextFont(0); TextSize(0); /* system font & size */ DrawText(*((**lHandle).cells), lDataOffset, lDataLen); HUnlock((**lHandle).cells); if (lSelect) { InvertRect(lRect); } } else if (!lMessage--) { /* toggle highlighting */ InvertRect(lRect); } } ------------------------CUT HERE----------------------- Compile this into a code resource of type LDEF, and off you go. Hope this helps, -- Amanda Walker InterCon Systems Corporation -- "Those preachers are right--there's more in these songs than meets the eye..." --Arlo Guthrie