«
 x

SuperCard: the easiest, most flexible way to make stuff for your Mac

Adding Font and Apple menus to your project

Using the Project Editor to add a menu to a project is simple. (Remember, the Project Editor is the default editing environment you use when you simply double-click a SuperCard project.)

Simply open the Project Browser window (click the Open Project Browser button in the Toolbar, choose Project Browser from the Tools menu, or press Command-J), click the Menus tab, then click the New Menu button. You'll be asked to name the new menu. You can give it pretty much any name you like, but this exercise demonstrates the two 'special' menus available to you. Name this menu "Fonts", then click Cancel when asked to make a new menu item. Click the New Menu button again, name this menu "Apple", and this time name the automatically offered new menu item "About Me".

When a menu called "Apple" is placed first in the menubar it automatically shows all of the standard Apple Menu contents, and enables the other standard menu bits and bobs as well, such as the Application and Help menus, and the menubar clock. Any SuperCard menu items placed into the SuperCard-generated Apple menu are shown before any OS-level items.

When a menu called "Fonts" is used, it automatically shows all currently available fonts, with no more work needed.

Just because you've made menus for this project doesn't mean you'll see them when you run your project. First you need to create the scripts which do this at the appropriate time; generally when the window or project is opened. This is actually easier than it might sound, because the ClickScript automatic script builder can help you set this up very simply.

Close the Project Browser window, then click the ClickScript button in the Toolbar (or choose ClickScript from the Tools menu). Click the Menus tab, then set up the following logical choices:

When the project is opened, then create a menuset. Use your two menus, remembering to first insert the Apple menu, then the Font menu. You don't have to create your menus in any particular order, but if you don't insert the Apple menu first then it won't do its magic with the additional menubar items.

You can find out more about what this does by clicking the Explain Action button, and see the script about to be made for you by clicking the Preview Script button. Once you're happy, click the Save button. This automatically generates the script needed to install your menus when your project is opened.

To see the results just run the project (Run Project button in the Toolbar, Run Project from the Go menu, or Command-R) and play with your newly created menus.

It is just as easy to pop up the Font menu from a button, or indeed anyplace on the card, as it is to use it in the menu bar. Create a button (for consistency in the interface choose Popup Menu in the button naming dialog; this gives it the popup menu 'triangle'), ensure it is selected, then use the Menus part of ClickScript to choose to pop up the Font menu when the button is pressed.

For a slightly more odd effect you can pop up the Apple menu just as easily. Just remember that this will feel rather odd to your users, so be sure you want your project to work this way.