Convert a HyperCard Stack to Revolution
Joe Wilkins February 6, 2007 Tutorials Mac Developer
I had every intention of responding to readers' comments about my last column on Revolution, and I’m going to do just that; but we’re also going to start with some serious Revolution activity after I make a few corrections to my previous offerings. Thanks to several of the RevList members, it was brought to my attention that I made a couple of erroneous observations and remarks. Should you go back to reread my previous articles, you will notice that I will have changed them a little to reflect the things that I am about to reveal - though not immediately! I suppose the most egregious comment that I made had to do with Rev’s omission of HC’s Background Layer; and that Revolution had merely provided a somewhat awkward substitute in the form of Grouping. After being called on the carpet with this item, I studied the reader’s comment and decided that I really can’t word what was said any better, so I am quoting it in its entirety here:
HC-style backgrounds are fully implemented and are easy to set up. You do need to start with a “group”, but after that you can use it exactly as HyperCard did. And if you ever import an old HC stack into Revolution, you will see the same behavior as this:
Make a single group containing the objects that are to be in your background. Set the group’s backgroundBehavior property to true (or check the box in the group’s inspector “behave like a background”.) That’s it. After that, you have a background exactly like HyperCard’s. You can refer to “background buttons” as opposed to “card buttons” if you like. You can ask for “the number of bgs.” All HC’s background scripting techniques work. Messages are sent from the card to the background to the stack, just as in HC. New cards that are made from a card displaying this background will also have the same background, just as in HC. You can ask for “the number of cds in this bg”, etc.
The difference – and advantage – is that you can have several background groups on the same card if you like (as well as card groups on the same card too.) Multiple backgrounds are handy in many cases. But if you want to stick with the more limited HC model, then just use a single background group and you will have behavior identical to HC. “This background” in a script will refer to the only background group in that case.
Jacqueline Landman Gay HyperActive Software
It would appear from the reader’s additional comments that this is a very common “first impression.” However, on reflection, I still don’t think I was that much off base, since the Background layer in Rev is neither genuinely easy nor automatic as it was with HC, and it gave me some trouble in the HC stack that I’m going to convert to Revolution in this article. In fact, it provided me with a number of Group related head scratchers to resolve. However, with HC I frequently found that I had to juggle handlers in my HC stacks to keep the various scripts from exceeding the 32k size limit; so being allowed to have multiple backgrounds may ease that pressure when the stacks have extensive scripting, doing a great many things. Of course, I’ve yet to uncover whether Rev has similar 32k limitations.
One of my other remarks pertaining to the inability in Revolution to shift/option/click on an object to open its script was in error. It should have been command/shift/click; in which case Revolution does just as HC does, but only when the browse tool is selected in both platforms.
Another Rev user took exception to my calling Revolution the “New HyperCard,” believing that SuperCard is the one filling that niche. It was suggested that I also take a look at two other cross platform development tools: Rebol and PythonCard, which I may well do after completing my journey with Revolution. By and large, all of the articles I’ve written so far have been well received. It was also brought to my attention that I had indicated the SE30 did not have a hard drive. I believe I was thinking of the Mac 512 enhanced to Mac Plus status that I was then using very early on.
Now, to get to work. We’re going to take a truly simple HC stack and convert it to Revolution. This is about as basic a stack as you will find anywhere. However, because of the use of “Joe’s Picture Fonts,” they appear more elaborate and complicated than they really are. This stack was created with a fairly early version of HC.
To convert the HC stack to Revolution, all I had to do was Open Revolution, then click File>Open and navigate to the HC stack and click the Open button. The transformation was almost immediate. Unfortunately, there were a couple of syntax glitches in the On OpenStack handler in the Stack script that required some attention. They mostly entailed conflicts with globals used and Revolution keywords; not serious, and doable.
The following is a screen shot of the first card in HC and System 9.2. Note that this card was created using my Picture Fonts for everything you see except the shadows and related line work which were done with HC’s paint and fill tools. You’ll see some examples of the individual fonts on the other cards that follow. Some of the “ordinary” text, usually in the New York or Geneva fonts, will appear in text fields, while the picture type are in paint mode. For that reason, the user doesn’t need my fonts in order to see the pictures.
The next screenshot of the first card is in Revolution and Mac OS 10.4.8. The basic difference is the difference between OS 9 and OS X, though Revolution did insert the buttons that weren’t there on the HC version for this card. The navigation provided by these buttons was in the stack script, but somehow Rev decided to Group all of these cards together; I think, because they had a common “blank” background in HC.
The next screenshot is of some of the basic Roof Fonts. I won’t always show both the HC and the Rev versions of most cards since they are almost identical. All of the cards in the HC stack had these buttons, except for the first one. Notice, however, that the icons for the buttons are far better in HC than those inserted by Revolution to take their place. You will notice some other anomalies later on; mostly regarding the location of text, and caused, I suspect, by the grouping substitution for the HC Background that Rev does “for you.”
Frankly, I think the “frame” that OS 9 provides around the windows is much better suited to both HC and Revolution than the “frameless” windows that OS X provides. During the time I’ve used OS X this “frameless” condition has come up to bite me a number of times in other applications; when, for some reason or another the Windows Title Bar got moved underneath the Menu Bar. With a frame, you can pull the window down, but without one, you’re SOL. We should at least have the option of having one or the other. I’ve actually lost entire documents because of this situation. It is a rare occurrence, however!
Yet another screenshot follows showing some of the things that can be done with my fonts. Even the Stucco stippling is done with a font. Again, only the shadow and some of the line work was done with HC Paint and Fill tools. Yes, the plants are fonts too. The next thing I might consider is the colorization of these picts.
Windows and shutters, most with a single keystroke and using a single byte of RAM memory.
This card is pretty self explanatory.
In the Revolution version, there is some conflict with the text, and, so far, has proven difficult for me to change.
Still in Revolution; more plants on the next card. Still all fonts except for the Horizontal lines.
Here are some of the Fonts used to create trees in plan view. Each one only takes a byte of memory, except the very large ones which take two keystrokes and 2 bytes of memory.
One thing I discovered: be very careful when you’re working with Groups that were created for you by Revolution when converting an HyperCard stack. Make sure you have a back up at all times. I just lost the text fields that were an integral part of this stack. The card above had descriptive and instructive text in the empty area at the bottom. No more! Maybe if I close the stack without saving, something you MUST do with Rev that was automatic with HC, the text may all be restored.
Viola! My hunch was right. All of the text is back; with HC it would have been gone for good. Trying to fix the overlapping text on the card above was where I messed up, but not automatically saving everything you do appears to be a beneficial, though unexpected (at least by me), feature in Revolution.
This is what the earlier card should have looked like; though, as you can see, there are some minor arrangement considerations with a converted stack. Not sure whether it is with the font used or what.
I’ll be back next Wednesday with a diagnosis of the Grouping “problem” and fixing the text problem. We’ll also save the Stack as a stand-alone application for both OS X and Windows. Since I’ve already taken a peek at what is involved, I know that I’ll need to create some Icons to be used in the application bundles. I am truly grateful to the Readers who provided some valuable feedback and I want to encourage all of you to do the same, even if you have to be overly critical. My skin is VERY thick.
Subscribe to our email newsletter
Sign up and get Macinstruct's tutorials delivered to your inbox. No spam, promise!