DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Frame definition files

Defining a simple menu

A menu definition file usually starts with a set of descriptors that pertain to the entire menu, known as frame descriptors. Frame descriptors are optional in menu definition files. If you choose not to define any explicitly, their default values apply to the menu.

The following menu definition file has no frame descriptors, and defines four simple menu items. (Blank lines between logical sections of frame definition files are recommended for readability.)

   name="Run UNIX System V"
   action=unix-system
   

name="Find Modified Files" action=`find $HOME -mtime -7 -print > modfiles`nop

name="Find Executable Files" action=`find $HOME -perm -100 -print > execfiles`nop

name="Exit My Application" action=exit

Menu.items: an example of menu item descriptors

The first item definition permits the user to access a full-screen UNIX system shell. The second item definition runs find(1) to locate files whose contents have been modified within the past seven days and saves the list of filenames in a file named modfiles. The third item runs find to locate files that are executable by the owner and also saves the output in a file named execfiles. The fourth menu item permits the user to exit from the application.

Because no frame or SLK descriptors were defined, their default values apply: for example, menu is a frame descriptor used to define a title for a menu. Since Menu.items did not explicitly define it, the default value Menu is displayed in the title bar. This menu would appear as follows:

Menu.items: screen output

The next example illustrates the use of several frame descriptors in the same menu definition file to change the appearance and add to the functionality of this menu:

   menu="My First Menu"
   begrow=center
   begcol=30
   framemsg="The message from my first menu"
   help=`message "A help message"`
   

name="Run UNIX System V" action=unix-system

name="Find Modified Files" action=`find $HOME -mtime -7 -print > modfiles`nop

name="Find Executable Files" action=`find $HOME -perm -100 -print > execfiles`nop

name="Exit My Application" action=exit

Menu.frame: an example of menu frame descriptors

The first group of descriptors are the frame descriptors. The frame descriptor menu defines a title for the menu, My First Menu. The begrow and begcol descriptors define the position of the top left corner of the frame in the work area. In this example, the top left corner of the frame will be located at the vertical center of the work area, and column 30 horizontally.

The framemsg descriptor defines a string that will appear on the message line when the frame is opened. It will remain on the message line until the frame is closed or made non-current (although it can be temporarily replaced by other, shorter-term messages). The help descriptor defines what will happen when a user requests help while the menu is active. In this example, the string A help message will be displayed on the message line.

``Menu.frame: screen output'' shows how Menu.frame will be displayed after these frame descriptors have been defined.

Menu.frame: screen output


Next topic: Creating multi-column and scrollable menus
Previous topic: Examples of menu definition files

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004