Article View: comp.sys.mac
Article #32271Re: Resource file HELP
From: Chris Johnson
Date: Mon, 19 Sep 1988 18:32
Date: Mon, 19 Sep 1988 18:32
36 lines
1402 bytes
1402 bytes
A big part of your problem is that you're using GetIndResource() instead of
GetResource(), which, I suspect, is really what you had in mind.
GetIndResource('TEXT', 256) will attempt to get the 256th resource of type
text in your resource file. GetResource('TEXT', 256) will simply attempt
to get a resource of type 'TEXT' whose ID is 256.
Also, if all you want to do is display some text in a window, you may find it
easier to use the TextBox() procedure.
The following source should work, assuming that the window you want to draw
into is visible and is also the current port.
Handle TextHand;
long TextSize;
TextHand = GetResource('TEXT', 256);
if (TextHand != noErr) {
LoadResource(TextHand);
if (ResErr == noErr) {
TextSize = GetHandleSize(TextHand);
if (MemErr == noErr) {
HLock(TextHand);
TextBox(*TextHand, TextSize, &view_rect, teJustLeft);
HUnlock(TextHand);
}
}
}
Hope this helps.
----Chris
Technical Details
Message-ID:
<6153@ut-emx.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cs.utexas.edu!ut-emx!chrisjReferences:
<MXAyfcy00Xc=MAOEQe@andrew.cmu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!cs.utexas.edu!ut-emx!chrisj From: chrisj@ut-emx.UUCP (Chris Johnson) Newsgroups: comp.sys.mac Subject: Re: Resource file HELP Message-ID: <6153@ut-emx.UUCP> Date: 19 Sep 88 18:32:19 GMT References: <MXAyfcy00Xc=MAOEQe@andrew.cmu.edu> Reply-To: chrisj@emx.UUCP (Chris Johnson) Organization: U.T. Austin Computation Center Lines: 36