HyperActive Software

Home What's New Who We Are What We Do Solutions Resources

We make software for humans. Custom Mac, Windows, iOS and Android solutions in HyperCard, MetaCard, and RunRev LiveCode


Converting a HyperCard stack to LiveCode

Notes about menus

How LiveCode menus work

A LiveCode menu consists of a set of popdown buttons, grouped together, and placed at the top of the card. The menu items that appear in each menu are just a return-delimited list stored in the button contents. The behavior of each menu is governed by the menu button's script.

On a Macintosh, if a menu group is not placed on a card, no stack menus appear in the Mac menu bar while that card is current. (There is one exception. It is possible to assign a default menu bar that appears when no other menu group is available. The default menu bar is only effective on Macs; if run on Windows, the stack will not have a menu on that card.) If a stack with no menus is run in development mode, LiveCode's developer menus will appear instead. If the stack does have a menu, then its own menus will replace the developer menus. In developer mode, the LiveCode menus can be accessed by bringing the message box, Tool Palette, or other native LiveCode stack to the front.

If a stack with no menus is run in player mode, the Mac menu bar will be empty except for the Apple and Help system menus.

On Windows machines, none of the above applies since there is no central menu bar. A card either has a menu or it doesn't. (LiveCode's developer menus are displayed in a palette.)

In LiveCode, double-clicking on a stack to launch LiveCode will launch the stack in player mode on any platform if you hold down the Command key while launching (on Windows, use the Control key.) There will be no menus unless the current card of the stack contains a menu group. If you should find yourself in the situation where you've opened a stack without a menu bar, you can use the stack's close box to quit the program, since LiveCode automatically quits when the last stack is closed. But if your stack is in a window without a close box, you may have to force-quit.

LiveCode menus are objects that take up room at the top of a card. On Windows, this is standard; menus appear at the top of each window. When the same stack is run on a Macintosh, LiveCode pushes the top portion of the card above the top border of the window, out of view. The body of the window shortens to accomodate only that portion of the card that contains the actual stack content. The card is still technically the same height, but the part of the height that contains the menu group is hidden from view. LiveCode handles this window resizing transparently between platforms.

One thing for HyperCard users to remember is that what appears to be coordinates "0,0" on a Mac screen will really be more like "0,26", because the first 26 pixels contain the menu group hidden under the top of the window. Any scripts that work with card coordinates need to account for that.

When to create menus

When you are building stacks from scratch, the best time to create the menu bar is first. Because menus take up space at the top of the card, at least a basic group should be created before anything else. If the menu group isn't there from the beginning, you'll probably have to move all other card objects downward eventually to accomodate one later. Unless you plan to run the stack entirely in development mode at all times, you will need at least the basic File and Edit menus anyway.

Things change when you are converting HyperCard stacks to LiveCode, because the card objects are already placed and there is no room for an extra group of menu buttons at the top of the card. In most cases, the card must be made taller to accomodate a menu group, and all the existing objects need to be moved down to a lower portion of the card underneath it. This can be done with a script, and we'll walk through it in the next step of the tutorial.

Editing menus or other groups

Since the menu bar is just a group of buttons, any single menu is edited just as any other button is. You can adjust their size, spacing, or other physical attributes if you don't like LiveCode's defaults. Of course, their appearance is immaterial on a Mac because the user will never see the actual buttons; they are instead turned into a real Mac menu bar at the top of the screen, and appear in the system font. On Windows, the buttons will be visible and the user will see them.

LiveCode offers a global property called selectGroupedControls, which is listed in the Edit menu as "Select Grouped Controls". You can toggle this property easily from the menu. If selectGroupedControls is true, then you can edit objects in a group without going into background editing mode. Clicking on an object while selectGroupedControls is true will select the object itself rather than the group containing it. When the property is false, clicking on a group selects the entire group, which is handy when you are repositioning it or you want to edit its script.

Getting into background mode: If you do not need to adjust the physical size or position of background objects, it is often easier to access their properties by using the Application Browser. If you do want to get into background editing mode: select the group in the Application Browser and click the "Edit Group" button in LiveCode's toolbar. To leave background editing mode, click the "Edit" button in the Overview again.

The special Help menu

All Macintosh and Windows menu bars contain a Help menu. LiveCode handles this menu button slightly differently than others. In order to function correctly, the Help button must be the highest-layered button in the menu group; that is, it must be the last button created in that group.

The last item in the Help menu must be the "About" item, and the item before that one must be a divider line (indicated by a hyphen in the button contents.) If this convention is followed, LiveCode will automatically place the About menu item into the first position in the Apple menu on Macintosh computers; it leaves it in its normal position under the Help menu on Windows. LiveCode handles this cross-platform issue for you. Any menu bar created by the Menu Builder tool will create these items in the proper position by default. All you need to do is add the appropriate scripts, which this tutorial will show you how to do.

LiveCode menu control characters

There are several punctuation markers you can add to menu items to control the appearance and behavior of menu items, but the two that most concern us here are these:

  • An ampersand (&) character before a letter will display that letter with an underline on a Windows machine. Windows users use these letters to select menus and menu items from the keyboard.
  • A slash (/) character after a menu item, followed by a letter, will display that letter as a Command-key equivalent on a Mac, or a Control-key equivalent on Windows.

You will see these symbols, and possibly others, if you look at the contents of any button that is part of a menu group. In the next section, we will use the Menu Builder tool to create menus and you will see them there.

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