RAPID Users' Guide

RAPID is the Rapid Ada Portable Interface Design Tool.  It was originally implemented by  Dr. Martin C. Carlisle and Capt. Pat Maes of the  United States Air Force Academy  Department of Computer Science. Since its initial release in November 1998, several people have contributed to the design and implementation of the tool.  Look under Help/About in RAPID for a list of contributors.

This page is intended to provide some basic information about using RAPID.  It is often hard as the implementor to know what things will be unclear to users.  If you have suggestions on how to improve this page, send them to:   Martin Carlisle

A good start is to look at the Original RAPID paper (postscript) presented at SIGAda '98.  This contains some basic information on how to use RAPID as well as more detailed information on the implementation.

Follow these links to:
 Starting RAPID
 Main program information
 Using the widgets
 Working with menus
 

Starting RAPID
When you first open RAPID, you will see a window that looks like the following:


 

At this point, the user should either open an existing .gui file or create a new one.  For each application develped using RAPID, the user should name exactly one window "main".  The main window is the controlling window for the application, and when this window is closed, the application will exit.

Alternatively, you can specify the name of a .gui file on the command line (or even set it so that RAPID opens when you double-click on a .GUI file in some windowing systems, including Win 95/98/NT).

Main program

The compile button generates Ada code to implement the designed GUI.  Then, the user must write the rest of the program, including a main program, which should look like the following:

with Tcl.Tk;
with Main;

procedure Demo is

   pragma Linker_Options("-ltcl80");
   pragma Linker_Options("-ltk80");

begin
   Main.Generate_Window(Main.Interp);
   Tcl.Tk.Tk_Mainloop;
end Demo;

Each window is then opened by calling its Generate_Window procedure with Main.Interp as an argument.  Main.Interp is the Tcl interpreter-- there is only one per application, and it is automatically allocated in the main package.  Callbacks occur when buttons are pushed, menu items selected, etc.  See  Using the widgets below for more information.

The package Tcl_Utilities in the lib directory contains useful functions for interacting with RAPID generated widgets.  For Radio buttons, the functions to read and set them are generated into the Window_Name_Widgets package (where Winow_Name is the name of the window selected within RAPID).

Using the widgets

All of the following widgets are selectable on the toolbar.  Push a button to select which kind of widget to create, then click and drag out the widget in the edit area to create a new widget.  Following this, a dialog will appear asking you to fill in properties for the widget.  Each widget must have a name.  To pick a name, follow the rules for Ada identifiers, but make sure the first character is lower case.  (If you type it in upper case, it will be changed to lower case, but this could make using the utilities confusing).  Most widgets have helpful procedures/functions in the lib/Tcl_Utilities package.

After a widget has been drawn, you can click and drag it to move it.  Also, if you click it, resizing buttons will appear.  Finally, right-clicking the widget reopens the properties dialog for that widget.

Following are the widgets currently supported in RAPID:

Text label.  This has text, justification (left, right or center), foreground color and background color.  For colors, you may enter the name of a common color (e.g. "red"), or enter an RGB value in hexadecimal preceded by a "#", (e.g. "#FF55FF").  Will display "Error" with a red background if the color is invalid.  You may also leave a color blank, which yields default behavior.
Text button.  This has text and an action.  An action is any Ada code that would be valid inside a begin/end block.  If it begins with an identifier, an appropriate "with" clause will be generated for the first identifier if it is fully qualified (i.e., if you specify "Common_Dialogs.OK_Box("Hi",Interp)" as an action, a "with" clause for Common_Dialogs will be generated automatically).
Picture button.  Same as above, but instead of text, has a picture (which should be the name of a GIF file).
Single line text entry.  This has an action which is performed when the user presses enter.  See Text button for a discussion of actions.
Check button.  Allows the user to turn on/off the check button.  Has a text label.
Radio button-- the radio button is unique among widgets as it comes in groups.  Only 1 radio button may be selected at a time.  The user must enter the group name along with the widget name.  All of the widgets in a group have an enumeration type generated for them in window_widgets.ads (where window is the name of this window).  In this same file are functions to select a particular radio, or ask which has been selected.
Listbox with optional scrollbars.  A list of items.  User can select foreground color, background color, scrollbar color and color used to highlight selections (see Text label for a discussion of colors).  Also can select whether or not to have a vertical or horizontal scrollbar.  Add and delete entries from the listbox (or query which is selected) using the utilities in Tcl_Utilities.  If an invalid color is chosen, the word "Error" will appear in the listbox.

Working with menus
If you push the "Menu" button, you will see a screen like the following:

From this screen, you can add submenus (displayed in blue) or choices (displayed in black).  To the left of each menu is either '>' or '|', which indicates if an insertion will occur as the first entry in the submenu, or after the submenu.  For example, if we insert now (with "Edit" highlighted), our insertion will be after "Edit", just before "Tools".  To toggle this, click on the '>' or '|'.

If we insert, we get a dialog with the properties.  The user must enter the name of the menu (what is displayed), its action (Ada code-- see the discussion of Text buttons in  Using the widgets  above), an underline position (which character is underlined, use 0 to underline the first character, 1 for the second, etc.), and a shortcut.  Shortcuts should like "Ctrl+X", to indicate that Ctrl+X also activates this menu item.

Once finished, push "Done" and you will see the menu above the editing area.