schorsch@oxy.edu (Brent William Schorsch) (01/27/91)
Hello bit twiddlers. I have been experimenting without success in
using 'styl' resources (loaded from my resource fork) in my text edit
records (created with TEStylNew(...)). There's not much documentation
that I have run accross and my assumptions appear to be flawed;it would
seem like I could call h = getresource('styl', id);
detachresource(h);
setstylHandle(h, myTEHandle);
Both the text (loaded from resource fork and entered via TESetText) and
the 'styl' resources were created directly in ResEdit so I'm confident these
resources are not to blame.
However, I repeatedly crash. (in no easily traceable manner).
Am I simply missing something or explicitly doing something improper?
Please respond if you've got any clues... Thanks.
+--------------------------------------------------------------------------+
Ando Moon. Linker Systems, Inc. "I think, therefore I Think C."
+--------------------------------------------------------------------------+matt@pacvax.UUCP (Matt Kingman) (01/30/91)
Try this:
********
Handle textHdl;
StScrpHandle styleHdl;
TEHandle teHdl;
teHdl = TEStylNew(&rect, &rect);
textHdl = GetResource('TEXT', id);
styleHdl = (StScrpHandle)GetResource('styl', id);
HLock(textHdl);
TEStylInsert(*textHdl, GetHandleSize(textHdl), styleHdl, teHdl);
HUnlock(textHdl);
ReleaseResource(textHdl);
ReleaseResource((Handle)styleHdl);
***********
---
Matt Kingman - Macintosh Software Engineer
Pacer Software Inc. - Westboro, MA 01581
Disclaimer: I speak only for myself.....amanda@visix.com (Amanda Walker) (03/05/91)
schorsch@oxy.edu (Brent William Schorsch) writes: >Am I simply missing something or explicitly doing something improper? The 'styl' resource is formatted as a stylScrapHandle, not a stylHandle... Try TEStylInsert(), for example... (note: routine names are taken from memory, and may not be quite right) -- Amanda Walker amanda@visix.com Visix Software Inc. ...!uunet!visix!amanda -- I pray for boredom, but it never comes.