HyperActive Software Home


Converting a HyperCard stack to MetaCard


Table of Contents

(Partial listing:)

Tips Card

Click on the Tips button to go to the Tips card. There is only one alteration we need to make here. You'll want to resize the Print Text button with the arrow tool to make it a few pixels higher, since MetaCard draws shadow buttons differently than HyperCard. The Print Text button script needs revision too. It contains two print card field instructions, which we need to change to use the printField script supplied by MetaCard. The Print Text button is on the card layer, so to access the script you only need to Option-Cmd-click on it with the arrow tool.

The printField handler exists in a sub-stack in the MetaCard environment, and accepts four parameters:

PrintField HeaderText,BodyText,FooterText,SourceFieldID
Except for the bodyText parameter, the others may be left empty. For printouts where you want headers and footers, those parameters can be filled. The sourceFieldID should be passed as well so that the handler can determine the correct font. In MetaCard, the long ID supplies the entire path to the object, whereas the short ID supplies only the ID number. Since the printField handler is located in another stack, we need to supply the long ID so that the handler can find it. Change the script so it looks like this:

on mouseUp
  start using stack "print field"
  if the hilite of card button "RadioButton1" is true then
    answer "Print" &"e& "How to get the most from tech support" \
        "e& "?" with "Cancel" or "Print"
    if it is "Print" then
      put the htmlText of cd fld "TipsField1" into ttext
      PrintField "",ttext,"",the long ID of cd fld "TipsField1"
    end if
  else
    answer "Print" &"e& "What to do if tech support is not available" \
         "e& "?" with "Cancel" or "Print"
    if it is "Print" then
      put the htmlText of cd fld "TipsField2" into ttext
      PrintField "",ttext,"",the long ID of cd fld "TipsField2"
    end if
  end if
  stop using stack "print field"
end mouseUp

Save the script. That's the only change to this card. There are a few notes about htmlText, a property that stores the text styles of a field, in the Other MetaCard Features section. If we had wanted the fields to print without any text styles, the script could have sent just the field reference to the printField handler.

Timer Cards

Choose the browse tool and click on the Timer button to go to the Timer card. The first Timer card needs no alteration. After a moment, the timer will appear to flip open and you will be on the second Timer card where the real business takes place.

We need to adjust the timer's numbers field, named "Elapsed Time", so it displays correctly. The field is covered by two transparent buttons. The first contains a script that "closes" the timer, and the one underneath it is a hilited button that causes the "Elapsed Time" field to display in reversed type -- that is, white text on a black background. MetaCard supports colored text in fields, so we no longer need the hilited button that is sandwiched in the middle. (The button may have lost its hilite during import; if so, it will be transparent.)

Using the arrow tool, move the top transparent button away from the "Elapsed Time" field temporarily. Click on the second transparent button that covers the number display and delete it.

Now click on the numbers field and resize it so that it exactly covers the entire white area of the number display (abut the right and bottom edges of the field even with the "bevel" line.) Double-click the field to see the Field Properties dialog, choose the Appearance tab, and turn off the 3D checkbox. Turn on both the Opaque checkbox and Fixed Line Height.

Since MetaCard allows colored text in fields, we'll set the timer text to green instead of white, to make it look more like a digital clock.

In the Field Properties dialog, click the Colors button. In the Color Palette, click the Background radio button and select black as the color (the square in the upper left corner.) Now switch over to the Name tab. This tab allows you to set colors using MetaCard's pre-defined color names. Click the Forecolor radio button and scroll down the names list to select "Green2". Close the Colors and Field Properties dialog.

Drag the original cover button back to its position over the top of the timer. Choose the browse tool and save the stack to disk.

Help Card

The Help card works fine as it is. No changes are needed.

Adjusting the backgrounds

On a Macintosh, where the default background color is white, the stack looks fine. But if you have looked at the stack on a Windows machine yet, you'll see that every card has taken on the system color scheme and all the white areas are now colored. We need to set some background properties so that our cards are both opaque and white on that OS.

Navigate to the first card of the stack (you'll have to use the arrow keys on your keyboard, or the message box to get there) and pull down the Control Browser from the Tools menu. Double-click the first background group (ID 13656) to show the Group Properties dialog. In this dialog, choose the Properties tab, check the Opaque checkbox and then click the Colors button. In the Color Palette, select the Background radio button and then click the white square at the lower right corner of the palette. This will set the background color to white and make it opaque.

You can leave all the dialog boxes open, and click on the stack to bring it to the front. Choose the browse tool again and click on the Records tab to go to that background. Repeat the above process, choosing the arrow tool and setting the background group "Records" to opaque and white. Choose the browse tool again, click on the Tips button, and do it once more for the "Tabbed Background" group. Be sure to click on "Background" each time in the Color Palette before setting the color to white, since the radio button will reset to "Foreground" when each new background is selected. Those are the only three backgrounds we need to set. When you are done, choose the browse tool, close all the dialogs, and save the stack to disk.

You will not see anything change on the Mac, but on a Windows machine it makes a world of difference.



Up to top | Converting Stacks to MetaCard - TOC | Next Page


Developer ResourcesHome

 

HorizontalBar

Contact us 5226 West Nokomis Pky, Minneapolis MN 55417


 

 

 

 

All contents copyright (C) 1996, HyperActive Software. All rights reserved.
Revised: December 3, 2001
URL: http://www.hyperactivesw.com/mctutorial/tutorialtoc.html