Although complicated, the Intuition Menu system is very powerful and flexible. The JForth EZMenu system was designed to make it easier to use these menus in your programs.

JForth EZMenu System

The JForth EZMenu system makes some assumptions about how you'd like your menus to look. Using these assumptions, it can do most of the work required to set up an Amiga Intuition menu. EZMenu assumes that the MenuItems will be lines of text arranged vertically, "regular menus" . You simply specify how many items to have and what the text will be. You can then determine a Forth word to be executed when you pick each item. You may also add command key equivalences, checkmarks with mutual exclusion, and other custom features as desired.

The EZMenu system is based around a special JForth structure called the EZMENU. This structure contains a complete Intuition Menu structure, plus a pointer to a block of IntuiText structures and a pointer to an array of CFA's, one for each menu item, and a count of how many menu items there are. You create one of these structures for each menu wanted. Most of the EZMenu routines uses this structure as one of its parameters.

Let's look at a simple interactive graphics program written in JForth to see how this EZMenu system is used.

Step by Step

This program will open a window and begin drawing colored lines or boxes in a random walk pattern. The pull down menu offers four choices. You can select between lines or boxes, clear the window, or quit.

The numbers in parentheses in this article correspond to numbers in the listing. This should make it easier to match code with the text.

Continued