bskendig@phoenix.Princeton.EDU (Brian Kendig) (12/03/89)
First, the situation: I'm designing a HyperCard stack (actually, now a SuperCard standalone) for NASA that will tie together a *lot* of technical documentation about the Space Station Freedom Manned Base and cross-link it. HyperCard is perfect for this, as I can freely mix text and diagrams, and still have it be simple enough for the common man to use. Or even for IBM-lovers to use, one would hope. Next, the problem: I have several documents that must be called up by the program. They range in size from about 5k to 100k. The program must be able to call them up at the click of a button and display them in a scrollable window. If the user clicks on one of the words in the displayed text, the program must be able to determine what word was clicked on, and take action depending on that word (e. g. "Figure 2.5" -> show the figure, 'SSFMB' -> show the acronym's meaning, 'Appendix B' -> show the appendix). The solution thus far: I place each document into its own scrollable text field on its own card. If the text has more than 32k characters, the field can't take it, so I have to chop the text up across cards. This confuses users sometimes, but it is the only solution I have been able to come up with so far. Taking action as a result of clicked words is no problem: I have written several scripts that are able to determine what the user clicked on and why he clicked on it, and will produce the appropriate result. Problems with this solution: First of all, scrollable fields in HyperCard are sluggish. The program hesitates for a moment when you click a scroll arrow; it is not obvious that you must hold the mouse button down over the arrow for a second (clicking on an arrow sometimes fails to scroll the text). Secondly, the vertical scroll bar is active even when all the text appears in the field; this again confuses users ("Why won't this scroll bar work? Must be a bug!") and makes *me* look bad. The biggest problem and most obvious kludge is that I cannot fit a large document in one field. Splitting it across cards is not an elegant solution. Ideally, I would like to write an XCMD or XFCN that will display a text file of arbitrary length in a scrollable window - not just a text field, but a window in its own right, with a vertical scroll bar. Reading the text off disk instead of hardcoding it in the stack allows me more flexibility. I think that I shouldn't have any problem reading the file (correct me if I'm wrong, but can't variable containers hold data of arbitrary length?). If I could pass the container with the text in it to an XCMD that would then display it, my problems would be solved. First difficulty - how do I coerce TextEdit to show the more than 32k and still allow for natural scrolling? (This is where the 'Eternal Question' bit comes into play - I imagine that plenty of people have asked this before!) If anyone has any code that would do this, or any suggestions on the matter, believe me, I'm all ears. I know it's possible - word processors do this kind of thing naturally. Second difficulty - how can I determine what word was clicked on in the text window? I achieve this right now with a lot of calculations in HyperTalk for the text field, but I'm not sure how I'd go about it in C. My development system consists of HyperCard 1.2.5, SuperCard 1.0, and THINK C 4.0. This stack is being designed on a Macintosh SE to run on a Macintosh IIci, so speed probably won't be an issue... Any help whatsoever (in the form of ideas or code) would be greatly appreciated. Also, if you happen to come up with another idea of how I could go about this whole business of displaying large amounts of text, please do suggest them! As soon as this program is in a more stable state and has been approved by the appropriate legal departments, I'll see about putting it in Sumex and on comp.binaries.mac. But that may not be until next Fall. Thank you for taking the time to consider this. << Brian >> -- | Brian S. Kendig | I feel more like I | bskendig | | Computer Engineering | did when I got here | @phoenix.Princeton.EDU | | Princeton University | than I do now. | @PUCC.BITNET | | Systems Engineering, NASA Space Station Freedom / General Electric WP3 |