CompuServe Thread

#TEXT Resource Display

7 messages in this thread
#131813From: Ron WhatleyJul 14, 1993 12:03 PM
How does one go about displaying text stored in a TEXT resource? Got any sample Pascal code? Thanks in advance, Ron
#131831From: Brian FitzgeraldJul 14, 1993 4:26 PM
> How does one go about displaying text stored in a TEXT resource? > Got any sample Pascal code? Something like this: textH := GetResource( 'TEXT', resID ); HLock( textH ); SetRect( dispRect, 50, 50, 350, 150 ); TextBox( textH^, GetHandleSize( textH ), dispRect, teJustLeft ); HUnlock( textH ); ReleaseResource( textH ); Of course, this won't scroll or anything. If you want to scroll through text, then you'll probably want to put the text from the resource into a TextEdit record, add a few scroll bars, etc etc. That's about 100-500 lines of code (100 lines for uncommented spaghetti, 500 lines for nice modular reusable code).
#131908From: Ron WhatleyJul 15, 1993 9:45 AM
Brian, Thanks for your help. >>> Of course, this won't scroll or anything. If you want to scroll through text, then you'll probably want to put the text from the resource into a TextEdit record, add a few scroll bars, etc etc. That's about 100-500 lines of code (100 lines for uncommented spaghetti, 500 lines for nice modular reusable code). <<< That's really what I'm after. I'll settle for some uncommented spaghetti if you've got some. I've got my own, but I obviously don't know what I'm doing. I have a help screen I've written that contains a topic list and a scrolling text area (which doesn't scroll yet). But I'm not doing a good job of recovering memory for what I've already got … losing 200-500 bytes each time I display new text. Rgds, Ron
#131924From: James W. WalkerJul 15, 1993 1:56 PM
> I have a help screen I've written that contains a topic list and > a scrolling text area (which doesn't scroll yet). If you don't mind reading C code (I think you requested Pascal) I posted code for the same task, called Show_help. Look for SHHELP.SIT in the libs, probably the C and Pascal Lib.
#132017From: Ron WhatleyJul 16, 1993 10:25 AM
Thanks James. I'll C if I can read it. Ron
#132002From: Brian FitzgeraldJul 16, 1993 2:46 AM
I don't have any uncommented spaghetti (I gave it up for Lent many years ago)! If you can't find any example source code in the MacDev libraries, let me know in a few days and I'll try to abstract some out. It's not that hard, really, but there are a few twists to getting it right.
#131918From: Brian FitzgeraldJul 15, 1993 12:13 PM
I neglected to mention that source code for the more complicated version is available. There are any number of "Help" libraries, that implement a "Help" function. At the heart of most of them is code that gets text from a resource puts it into a TextEdit record lets you scroll around in it Search the MacDev libraries on the keyword "help" and see what turns up. I seem to recall one in particular that was called "ShowHelp".