Printer Friendly

HyperCard 2.0: a closer look.

[FIGURES HAVE BEEN OMITTED]

In September, we took our first detailed look at HyperCard 2.0. This column continues with an examination of more features and enhancements.

User-Definable Menus

HyperCard 2.0 now gives users and developers the ability to fully control the appearance and behavior of standard menus and menu items, as well as the ability to create custom menus without the need for external resources.

You can now enable, disable, and delete existing menu items with few exceptions. You can al- assign co-and key equivalents to a menu item, add special character marks to a menu, including checkmarks, change its name or text style, and specify a HyperTalk script that is to be run when that menu item is chosen. Unfortunately, HyperCard 2.0 does not currently support the creation of hierarchical menus.

To create a new menu just use the HyperTalk expression "create menu <menuName>" where <menuname> is the name of the menu you give it. So for example, typing "crate menu I Love Lucy"' in the message box, adds a new menu called "I Love Lucy" in the menu bar (Figure 1).

Me following stack script shows how a sample menu with menu items and command key equivalents can be created when a stack is Opened: on openstack stop the user from seeing the Changes lock screen thiS line creates the menu create menu 'I Love LUCY' Now put the items into the menu. Note that -the -' mark puts a non-accessible dashed line -across the menu. It is useful for grouping -menu items together put Lucy,Ricky,-,Fred,Ethel,-,Little Ricky' into menu 'I Love Lucy' -Set the command key equivalents for the menu items set the cmdChar of menuItem Lucy' of menu 'I Love Lucy' to 'L' set the cmdChar of menu Item "Ricky' of menu 'I Love Lucy' to R' set the cmdchar of menu-item Fred' of menu I Love Lucy' to F' set the cmdchar of menuitem 'Ethel'of menu 'I Love Lucy' to E' Disable one of the menu items disable menultem Little Ricky' -Show the user the menu changes unlock screen end openstack

Now that we've created the menu, how do we make it do something? It's easy. By invoking the "domenu" command, you can have HyperTalk take over your menu -d control its behavior.

In the following stack script, we can have our "I Love Lucy,, menu answer the user when the menu item is chosen: on domenu McGillicudy

if McGillicudy = 'Lucy' then

answer 'Is that you, Ricky?'

end if

if McGillicudy = Ricky' then

answer "Lucy, I'm home!'

end if

if McGillicudy = Fred' then

answer 'Ethel, where are you?'

end if

if McGillicudy = "Ethel' then

answer Oh, Fred! I'm fight

here where you left me!"

end if end doMenu

Built-in Icon Editor

Previous versions of Hypercard did not permit users to edit and/or create icon., On the fly. were, forced to either use ResEdit or some other utility like Hyperpress Publishing's Icon Factory. 'This has changed.

HyperCard 2.0 now contains a built-in Icon Editor that allOWS users and developers to create and edit icons in the current stack. You can access the Icon Editor by either choosing Icon... from the Edit menu or choosing the Edit" button from the scrolling icon risk which is accessible from the Icon button in the Button dialog box.

The Icon Editor (Figure 2) permits complete control over icon creation and includes a variety of special tools for that purpose. One of the more intriguing tools is the Pickup item. When you choose pickup from the Icon menu, a 32x32 rectangular snapshot tool appeals Just place the rectangle over the artwork or SCreen area you literally want to pick up and click the mouse button. The "snapshot" replaces the image of the current icon that is in the Editor (if any).

Faster, More Powerful HyperTalk

HyperTalk has been greatly enhanced in HyperCard 2.0. There are over sixty new variables, properties, functions, cOmmands, messages, and visual effects. Furthermore, almost every new Property added to Hypercard is now accessible via a HyperTalk command. In other words, if you can do it via a pull-down menu and some button clicks. you can script it, too.

In addition to these new features, HyperTalk is faster than ever before. HyperCard 2.0 sports a built-in compiler that translates HyperTalk scripts into 68000 machine code instead of interpreting it as in the past. The code stays memory until HyperCard quits or needs the memory for some other operation. This means that a HyperTalk message will be executed much faster upon its next invocation.

Since I was working with a beta copy at the time of publication, I was unable to put fl" to a test. As is normal in the computing world, tweaking the speed to optimal limits is usually the last thing done to a program, and HyperCard is no exception to this rule.

New XCMDs

HyperCard 2.0 SPOTTS two new built-in XCMDs, Palette and Picture. The Palette XCMD now allows HyperCard developers to create customized floating command palettes. These command palettes act just like normal Hypercard buttons except they exist in their own window, which floats on the surface of the stack.

A user-defined palette consists of two resources: a PLTE (palette) resource and a PICT resource, which acts as the palette's artwork. Palette also supports the PICT2 format, which means you can have color palettes.

To make life easier for us, HyperCard 2.0 comes with a stack called Palette Maker" that does most of the work. All you have to do is draw the artwork and add transparent buttons that contain a one-line HyperTalk script such as "go to next card." Click on the Create Palette button and you're all set. To copy the PLTE and PICT resources, Palette Maker also comes with a HyperCard 2.0compatible version of Steve Maller's indispensable ResCopy utility.

HyperCard 2.0 also comes with a preconfigured palette called Navigator" that can be invoked at any time by typing the phrase palette Navigator... in the message box or by putting that message in a button script (Figure 3). Navigator incorporates the eleven items found in the Go menu.

The other resource is called "Picture." HyperCard 2.0 still does not support color in general. It was de-cided that the degradation in speed caused by large card sizes was acceptable, but that caused by the introduction of color was not worth the potential benefits.

Picture gets around the color limitation by allowing the user to display a PICT or MacPaint file in all of the Macintosh's color or gray-scale resolutions, ranging from monochrome to 24-bit color. The picture appears in its own external window (which is also user-definable) can come from a file, resource, or the Clipboard.

In conjunction with the Picture XCM', is a new HyperTalk expression named "pictureClick" that lets your stack get the location of any mouse click inside the picture's window. For example, you could have a gray-scale picture of a street map. If the user clicks on a portion of the map, you could invoke pictureclick to perform some sort of an action, such as giving the exact street coordinates in a card field.

The Script Editor

HyperCard 2.0 features a new, improved Script Editor and several debugging tools (Figure 4). All of these are implemented as XCMDs.'Re Script Editor is invoked the same way as before. Either click on the Script button in the Info dialog box (depending on which object you're looking at) or by various keyboard combinations and mouse clicks.

The new editor looks like a document window, contains its own script menu, and not only has vertical but horizontal scroll bars, meaning you can finally look at those long, long HyperTalk messages without having to add line breaks to them. You can also have multiple script windows open at the same time, which aids in cutting and pasting between scripts.

In addition, you have access to various tools that aid in debugging. You can add temporary or permanent checkpoints to a script. Doing this gives you access to the built-in Debugger, Message Watcher, and Variable Watcher. Needless to say, experienced HyperCard programmers will love this feature.

Improved Finds and Sorts

Several changes and enhancements to the find and sort routines have been incorporated in HyperCard 2.0. In addition to the commands Find, Find whole, Find word, and Find string, a new property, Find chars, has been included. Find chars is similar to Find string in that it can find a string of text. For example:

find string ting card'

find chars ting card'

will find any text string containing the string "ting card" like "printing cards." Both ignore word beginnings and endings, which means that you can search for characters inside words or merely word endings without beginnings.

The crucial difference between the two is that Find string is non-Boolean while Find chars automatically uses the Boolean term "AND." In other words, Find string looks for a perfect match ("ting card') while Find chars will stop on both phrases because it permits each element to be in different locations on the same card "ting" or "card").

Another new feature of the Find command is not necessarily in the command itself but in the form of a new property that has been included in the field, card, and background objects. This new property is called "Don't Search."

When that property is turned on, it tells HypeTCard not to search for a term in that field, card, or background. As a result, you can prevent users from looking for a searchable term or string in, for example, a hidden look-up field or a special card that you want to hide from the user unless a specific action is performed to make the card visible.

Start Using Property Among the most exciting new features of HyperCard are two HyperTalk properties: Start using and Stop using. Previous to HyperCard 2.0, creators of multiplestack applications frequently needed to share stack-level handlers and resources. Originally, there were only two ways to tackle the problem, and each method created its own problems. You could (1) duplicate those handlers and resources in all your stacks, or (2) place them in the user's Home stack.

The first method is very inefficient, since adding afl those handlers and resources would increase die size of each stack and could even add to the number of disks to be distributed.

The second method meant copying handlers and resources onto a stack you, the developer, didn't know. What if there were already resources and handlers that might conflict with those already on the user's Home stack? What if there were not sufficient space on the user's Home stack for your handlers? (A stack script has an effective limit of 30,000 characters.)

The solution was to allow the developer's stacks that contained those special handlers and resources to be placed in the message hierarchy before the Home stack. This is done by using the Sm using command. For example:

Start using stack Fred' places a stack named Fred" in the message Werarchy just before the Home stack (Figure 5). Any stack-level handlers or resources (which can include icons, XCMDs, sounds, etc.) are now accessible to your stack. Any stack placed in the message hierarchy is open internally, meaning it is not visible to the user unless the user specifically opens it via the Open Stack command. In addition, HyperCard 2.0 allows up to ten "shared" stacks to be inserted into the message hierarchy at any one time, depending on available memory.

At any point, you can remove a shared stack from the hierarchy with the Stop using command. For example:

Stop using stack Fred' removes the stack named Fred" from the message hierarchy. Its stack-level handlers and resources are no longer available to you. Remember, HyperCard will not automatically remove your stack from the message hierarchy when you quit HyperCard. To remove it, you must employ the Stop using command.

To try this out, you will need to open two stacks. First, open your Home stack (make sure your Home stack is set to "scripting" in the User Preferences card). Men create a new stack by choosing "New Stack" from the File menu. Name the new stack "Test." Be sure to choose the "Open stack in new window" option so your new stack opens in a separate window from the Home stack. Otherwise, the new stack will replace the Home stack.

Open up the stack's script editor by holding down the Shift key and choosing "Stack Info..." from the Objects menu (or by pressing Command-Option-S simultaneously) and enter the following handler:

on Fred

answer "Congratulations! You made

it to the Test stack!' with Hooray!' end Fred

Close the script editor by pressing the Enter key and close the test stack by clicking on the close box. Open the Message box by choosing "Message" from the Go menu or pressing Command-M simultaneously on the keyboard. Type the following into the Message box and hit Return:

Fred

You should get a message saying that HyperCard cannot find the handler. Now PM the following into the Message box:

Start using stack Fred'

Hit Return. Now type "Fred" into the message box again. You should now get the answer message you placed in the test stack's stack script. Finally, type the following into the Message box:

Stop using stack Fred'

Hit Return and type Fred" into the Message box. Once again, you should get a message that HyperCard wasn't able to locate the handler. To Convert or Not to

Convert? So, you're probably wondering, "What do I do with all my old stacks?" Not to worry. Although HypcrCard 2.0 uses a new stack format that is not compatible with versions 1.2.5 and earlier, it will open those stacks in read-only format. This means that you will not be able to make any changes to your Hyper-Card .x.x format stacks unless you convert them to 2.0 format.

Converting stacks to 2.0 format is as easy as pulling down a menu item. Just open a Hyperstack and choose Convert S tack from the File menu.

The conversion process takes a few moments depending on the size of the stack. Be aware that once you've converted your stack there's no going back, so you might want to save a copy in the old format, just in case.

Other Goodies

HyperCard 2.0 will ship with some new and greatly improved stacks as well as an expanded, interactive Help stack. Among those to be included are a clip-art stack, a puzzle, and stacks that contains ready-made buttons and fields. Be sure to examine the scripts, since there's a lot you can learn from them.

HyperCard 2.0 is now fully compatible with MultiFinder. It will allow searching, sorting, compacting, and running of scripts in the background. If you are working with another program, it will notify you when it needs your attention.

Next is "Don't Wrap." This specifies whether text should automatically wrap at the end of a line in a field. This can be used to great effect in conjunction with the clickline property for "hot" text. As with the Don't Search property, it can be set either via the Field Info dialog box or by HyperTalk scripting.

The "shared text" property allows a HyperCard designer to enter text in a background field and have that text appear in every card using that background. addition, there is the "sharedHilite" property for buttons which can specify whether the hilite property for that button is in effect for each card in that background.

Can't Peek" turns off the user's ability to peek at buttons and fields using the CommandOption and Command-OptionShift keys, respectively, while in the browsing mode. This can be set in the Protect Stack dialog or via a HyperTalk script.

Finally, there's "Can't Abort." Checking this box in the Protect Stack dialog turns off the user's ability to stop the of a script by typing Command -period simultaneously It is intended solely to protect users from those states that can result when critical portions of a script have not been allowed to execute completely. Be extremely careful when using it, however, since it disables HyperCard 2.0's built-in protection against runaway scripts.

Product Discussed HyperCard 2.0 Apple Computer, inc. 20525 Mariani Avenue Cupertino, CA 95014 $49.95 with complete documentation. Distributed free with every new Macintosh. Free from users groups, book publishers, and participating authorized Apple dealers. Requires a Macintosh Plus, SE, SE/30, II, IIx, IIcx, IIci, IIfx, or Portable with minimum 1MB RAM. Hard disk highly recommended. System 6.0.5 or greater required.
COPYRIGHT 1990 Information Today, Inc.
No portion of this article can be reproduced without the express written permission from the copyright holder.
Copyright 1990 Gale, Cengage Learning. All rights reserved.

Article Details
Printer friendly Cite/link Email Feedback
Title Annotation:part 3
Author:Vaccaro, Bill
Publication:Computers in Libraries
Article Type:column
Date:Nov 1, 1990
Words:2787
Previous Article:Design your own DOS menu system, part II; a customized menu can be created with a DOS batch file.
Next Article:Pictures from space.
Topics:

Terms of use | Privacy policy | Copyright © 2021 Farlex, Inc. | Feedback | For webmasters |