89 lines
55 KiB
Plaintext
89 lines
55 KiB
Plaintext
1
|
||
|
||
LISP LIBRARY PACKAGES MANUAL
|
||
1
|
||
|
||
LISP LIBRARY PACKAGES MANUAL
|
||
FREE MENU
|
||
1
|
||
|
||
USER INTERFACE
|
||
1
|
||
|
||
|
||
|
||
|
||
FREE MENU
|
||
6
|
||
|
||
Free Menus are powerful and flexible menus that are useful for applications that need menus with different types of items, including command items, state items, and editable items. A Free Menu lives in a window, which can be opened and closed as desired, or attached as a control menu to the application window.
|
||
2
|
||
|
||
Making a Free Menu
|
||
1
|
||
|
||
A Free Menu is built from a description of the contents and layout of the menu. As a Free Menu is simply a group of items, a Free Menu Description is simply a specification of a group of items. Each group has properties associated with it, as does each Free Menu Item. These properties specify the format of the items in the group, and the behavior of each item. The function FREEMENU takes a Free Menu Description, and returns a closed window with the Free Menu in it.
|
||
Probably the easiest way to make a Free Menu is to define your own function which calls FREEMENU with the Free Menu Description right there in your function. This function can then also set up the Free Menu window as required by the application. The Free Menu Description is then saved as part of your function when you save your application.
|
||
Alternatively, you can save the Free Menu Description as a variable in your file, and then just call FREEMENU with the name of the variable. This may be a more difficult alternative if you want to use the backquote facility to built your Free Menu Description. See the section Free Menu Item Descriptions.
|
||
Free Menu Formatting
|
||
1
|
||
|
||
A Free Menu can be formatted in one of four ways. The items in any group can be automatically layed out in rows, in columns, or in a table, or else the application can specify the exact location of each item in the group. Additionally, Free Menu keeps track of the region that a group of items occupies, and items can be justified within that region. This way an item can be automatically positioned at one of the nine justification locations, top-left, top-center, top-right, middle-left, etc.
|
||
Free Menu Description
|
||
1
|
||
|
||
A Free Menu Description, specifying a group of items, is a list structure. The first thing in the list is an optional list of the properties of this group of items, in the form:
|
||
(PROPS <PROP> <VALUE> <PROP> <VALUE> ...)
|
||
The key word PROPS determines whether or not the optional group props list is specified. The section Free Menu Group Properties describes each group property. For now, the important property is FORMAT. The type of formatting determines the syntax of the rest of the Free Menu Description, in a very simple way.
|
||
When using EXPLICIT formatting, the rest of the description is any number of Item Descriptions, which have LEFT and BOTTOM properties specifying the position of the item in the menu. The syntax is:
|
||
((PROPS FORMAT EXPLICIT ...)
|
||
<ITEM DESCRIPTION>
|
||
<ITEM DESCRIPTION> ...)
|
||
When using ROW or TABLE formatting, the rest of the description is any number of item groups, each group corresponding to a row in the menu. These groups are identical in syntax to an EXPLICIT group description, with an optional PROPS list and then any number of Item Descriptions, except that the items need not have LEFT and BOTTOM properties, as the location of each item is figured out by the formatter. But the order of the rows and items is important. The menu is layed out top to bottom by row, and left to right within each row. The syntax is (the comments are not part of the description):
|
||
((PROPS FORMAT ROW ...) ; props of this group
|
||
(<ITEM DESCRIPTION> ; items in first row
|
||
<ITEM DESCRIPTION> ...)
|
||
((PROPS ...) ; props of second row
|
||
<ITEM DESCRIPTION> ; items in second row
|
||
<ITEM DESCRIPTION> ...))
|
||
When using COLUMN formatting, the syntax is identical to that of ROW formatting. However each group of items corresponds to a column in the menu, rather than a row. The menu is layed out left to right by column, top to bottom within each column.
|
||
Finally, a Free Menu Description can have recursively nested groups. Anywhere the description can take an Item Description, it can take a group, marked by the key word GROUP. A nested group inherits all of the properties of its mother group, by default. However, any of these properties can be overridden in the nested groups PROPS list, including the FORMAT. The syntax is:
|
||
( ; no PROPS list, default row format
|
||
(<ITEM DESCRIPTION> ; first in row
|
||
(GROUP ; nested group, second in row
|
||
(PROPS FORMAT COLUMN...) ; optional props
|
||
(<ITEM DESCRIPTION> ...) ; first column
|
||
(<ITEM DESCRIPTION> ...))
|
||
<ITEM DESCRIPTION>)) ; third in row
|
||
Here is an example of a simple Free Menu Description, for a menu which might provide access to a simple data base:
|
||
(((LABEL LOOKUP SELECTEDFN MYLOOKUPFN) (LABEL EXIT SELECTEDFN MYEXITFN))
|
||
((LABEL Name: TYPE DISPLAY) (LABEL "" TYPE EDIT ID NAME))
|
||
((LABEL Address: TYPE DISPLAY) (LABEL "" TYPE EDIT ID ADDRESS))
|
||
((LABEL Phone: TYPE DISPLAY)
|
||
(LABEL "" TYPE EDIT LIMITCHARS MYPHONEP ID PHONE)))
|
||
This menu has two command buttons, LOOKUP and EXIT, and three edit fields, with ID's NAME, PHONE, and ADDRESS. The Edit items are initialized to the empty string, as in this example they need no other initial value. The user could click after the Name: prompt, type a person's name, and then press the LOOKUP button. This would cause the function MYLOOKUPFN to be called, which could look at the NAME Edit item, lookup that name in the data base, and then fill in the rest of the fields appropriately. Note that the PHONE item has MYPHONEP as a LIMITCHARS function. This function would be called when editing the phone number, in order to restrict input to a valid phone number. After looking up Perry, the Free Menu might look like:
|
||
|