It's Done! Except...
Congratulations! The converted stack is ready to run now on any OS that MetaCard supports, which is most of them. Without any changes, you can copy the stack to any computer and it will work as long as that computer has the platform-specific version of MetaCard installed. The stack will take on the look and feel of the current OS without any additional work on your part.
There are some optional additions over and above those provided in the original stack which you may want to make though. The primary enhancement for many will be the addition of MetaCard's integrated color capabilities.
We will leave color choices up to your own creative talents, and offer only a few guidelines on how MetaCard's color works.
Please remember: Jim Stephenson has been kind enough to allow HyperActive Software to use his Tech Support TimeSaver stack as the basis for this tutorial. He owns the copyright and retains the right to distribute the stack and all its derivatives. The changes you make to Tech Support TimeSaver while working through this conversion tutorial are yours to use as you like, but you may not distribute your derivative stack to anyone else. You do have the right to send others the original, unaltered HyperCard stack and a link to this tutorial, so that they can create their own MetaCard derivatives.
Accessing colorThe easiest way to color objects is to use the Color Chooser, which is accessed by clicking the Colors button in the Properties dialog box of any object (including the Stack Properties and Card Properties dialogs.) The easiest way to determine which color setting does what is just to experiment.
Alternately, color can be scripted. This is most useful for stacks that need to change object colors dynamically via scripts in response to user actions, but it is also possible to assign colors during stack development by typing color commands into the message box. See MetaCard's Reference stack for more information on scripting color commands.
MetaCard's color and pattern inheritanceMetaCard's color and pattern assignments follow a hierarchy of inheritance very similar to the message hierarchy. If an object has a color assignment, then that is the color it will display. (Actually, objects can have up to 8 different color assignments. Each one is inherited independently.) If there is no color assignment for an object, it inherits color from the next object up the hierarchy. If that object has no color assignment, it inherits from the object two steps up, and so forth, all the way up to the Home stack level. If the Home stack has no color assignment, then some colors (such as hilite color) are pulled from the operating system preferences. (Versions of MetaCard prior to 2.4 do not inherit from the OS.)
For example, say we have a button in a group, which is placed on a card. If the button has its backgroundColor set to blue and its foregroundColor set to gray50, then the button will have gray text on a blue background. If the button has no color properties set, then MetaCard will look at the group that contains the button to see if the group has any color properties set. If so, the button will take on the group's color settings. If there is no group color assigned, MetaCard looks at the card, then the stack, and then the Home stack to see if any of those have color assignments. The first place it finds a color assignment, that will be the colors the button assumes.
Patterns are inherited in the same way. You can set a group's background pattern, and every object in the group will use the same background pattern unless they have their own assignment. This is especially handy in OS X, where dialogs contain background patterns rather than colors.
This is convenient if you decide to change a color scheme in the middle of designing a stack. If you set the the foregroundColor of a group to gray50, then every text element in the group (this includes field text and button labels) will use that color for text. No colors at all need to be assigned to individual buttons or objects unless you want those objects to use different colors than the group's. If you later decide you don't want gray50, just set the group's foregroundColor to something else and every text element in the group, except those which have been set individually, will take on the new color. It is possible to change every text element in an entire stack with a single command, just by setting a stack's foregroundColor property. Not that you probably would -- but you can.
Moving HyperCard color into MetaCardIf you are porting a HyperCard stack that uses AddColor, much of the original color will have to be reassigned manually, especially if you have assigned color to buttons and fields individually. This is one of the more tedious tasks in porting a HyperCard stack, but fortunately it only needs to be done once.
If you have many objects that use the same colors, you can often write a short, temporary stack script that responds to a keystroke or some other trigger and then sets all the color properties for the selected object at once. HyperActive Software has used this method with fair success in the stack ports we've done.
If your stack employs color PICT resources for use with HyperCard's AddColor or Picture commands, you can bring them into MetaCard and display them with MetaTalk syntax.
One of the easiest ways to pull all the PICT resources out of your HyperCard stack is with the shareware program GraphicConverter from Lemke Software. This program can scan the resource fork of a file and save every PICT, icon, and other image to files on disk. It can also batch-convert those files to jpg or gif format, which are not only efficient graphic formats, but ones which all operating systems understand. MetaCard will allow you to place images in PICT format, but they will only display on Macintoshes. It's better to just convert them right off the bat before bringing them into MetaCard. MetaCard supports gif transparency, so that's the format you should use for any images where white space should be transparent.
Once you have converted the PICTs to jpg or gif, use the Import menu item under MetaCard's File menu. Click the Image tab in the dialog and choose the graphic file to import. Make sure the correct stack name is chosen in the "Put into stack:" popup button.
Note: If you want the image to be physically imported into the stack, make sure the "Link Only" button is NOT checked. If the "Link Only" button remains checked, which is the default setting, only a reference to the image on disk is placed in the stack. If the stack is run on another computer without that image on disk, the picture will disappear from the card. Images which are physically imported (i.e., not merely linked) become part of the stack's file structure, and the original image on disk is no longer needed.
Click the "Import" button and MetaCard places the image on the current card. If the stack is currently in background editing mode, the image is placed within the current background (group).
In MetaCard, images are objects. You can give them scripts, move them around, have them respond to mouse events, double-click them with the arrow tool to edit their properties, and so on.
All contents copyright (C) 1996, HyperActive Software. All rights reserved.
Revised: December 3, 2001