|
Table of Contents(Partial listing:)
|
General conversion guidelines: what will and will not transferFor the most part, almost all aspects of a HyperCard stack will convert to MetaCard with little alteration. There are a few things that are done differently in MetaCard, however, which always need to be modified. Most of the differences are due to the cross-platform capabilities of MetaCard that HyperCard lacks. For example, the Macintosh resource fork, while supported by MetaCard on Macs, is not available on other platforms. Therefore MetaCard provides alternate ways of handling color, pictures, sounds, cursors, icons, etc. For all of these, the resources are stored instead in the data fork of the stack, which all platforms recognize.Issues which need to be addressed during conversion are:
In addition, the MetaCard compiler is much more particular than HyperCard in some areas of syntax. Function calls must always be preceded with "the" (as in the length of myString) or used with the parenthetical syntax (i.e., length(myString)). The longer English form will not work without the preceding "the". For example, length of myString will usually error.
MenusHyperCard's method of working with menus is incompatible with MetaCard and all menu commands will need to be rewritten. For a fuller explanation of how MetaCard menus work, see About MetaCard Menus later in this tutorial. A large part of this tutorial involves setting up and managing MetaCard menus, with a walk-through in the Adding a Menu Bar section.
XCMD/XFCN Substitutions and Resource Fork ItemsOur example stack contains no XCMDs, so a brief discussion here is appropriate. When MetaCard imports a HyperCard stack, the resource fork is stripped off; the most common resources are automatically moved to the data fork and all other resources are lost. In general this is preferred behavior because MetaCard provides built-in commands for nearly all the features that HyperCard users commonly use externals to accomplish. The best way to address XCMDs in your converted stack is to note where they are used and substitute the native MetaCard syntax to accomplish the same thing. In very rare cases, an XCMD will be necessary. If the stack will be run on a Windows machine, a matching DLL will also be needed.The most common XCMD used in HyperCard stacks is AddColor, which provides a color overlay that HyperCard itself knows nothing about. Quite a bit of scripting is usually necessary to support color in HyperCard and colorized stacks generally have addColor calls sprinkled liberally throughout their scripts. Since color is built into MetaCard, none of those scripts are necessary and, in fact, will error repeatedly in MetaCard until they are removed. The best approach for handling colorized HyperCard stacks is to completely remove all addColor handlers and references from the scripts before doing the import into MetaCard. If you do this, the number of compiler errors you will receive from MetaCard will be substantially reduced, not to mention your frustration level. Resources that are automatically imported and moved to the data fork during a MetaCard import include button icons, sounds, and cursors. Icons are automatically assigned to the correct buttons, and sounds and cursors will work when called in scripts. The conversion of these resources is transparent.
Report printingMetaCard supports several forms of the print card command and ships with a printField handler that will print the contents of a field. The use of both of these is demonstrated in the tutorial. However, MetaCard does not contain HyperCard's report engine. Scripts that use report templates or rely on print stack menu commands will need to be rewritten. While report printing is beyond the scope of this tutorial, there are scripted methods of accomplishing it, though none are as easy as HyperCard's built-in report generator. This tutorial contains a very simple script, which can be found in the Records Cards section, which duplicates one of HyperCard's Print Stack options.
Reserved word variable names
Unquoted literal strings will fail much of the time, though there are minor exceptions. Good HyperCard programming demands that literals are always quoted; if you are not yet in the habit of doing so, start now. Quoted literals execute much faster in HyperCard anyway, and they are required in MetaCard.
|
 
 
All contents copyright (C) 1996, HyperActive Software. All rights reserved.
Revised: December 3, 2001
URL: http://www.hyperactivesw.com/mctutorial/tutorialtoc.html