DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Introduction to the Form and Menu Language Interpreter (FMLI)

An example application

Here is an example FMLI application consisting of a menu frame definition file named Menu.sample and a text frame definition file named Text.welcome:

menu=TOP MENU

name=date
action=`date | message`nop

name=welcome
action=open Text.welcome

name=exit
action=exit

Menu.sample: a simple menu frame definition file

The file Menu.sample is named according to the conventions defined for FMLI frame definition files, and defines the initial frame to be opened when this example application is run. See ``The Form and Menu Language'' for a complete discussion of file naming conventions.

The first line of code uses the FMLI descriptor menu to define the title that will appear in the title bar of the menu frame. Many FMLI descriptors have a default value that will be used if you do not explicitly define the descriptor in the frame definition file. If the menu descriptor were not defined in this file, the title of the menu would default to Menu.

The next two lines of code define the first menu item. The name descriptor defines the name of the item to be date. The action descriptor defines what will happen when the user selects the date menu item: the UNIX system date(1) command will be run and the output will be piped to the FMLI built-in utility message(1fmli), which displays the output of date on the FMLI message line. The FMLI command nop does nothing (no operation), but must be present because FMLI expects the action descriptor ultimately to evaluate to an FMLI command. If it does not, the terminal will beep.

The fourth and fifth lines of code define the menu item welcome and the action to execute when welcome is selected: open another frame in the work area, in this case the text frame Text.welcome, which displays a welcome message. ``Text.welcome: a text frame definition file'' shows the contents of the text frame definition file Text.welcome.

The last two lines of code define the menu item exit and its action: run the FMLI command exit, which terminates the FMLI session and returns the user to the UNIX shell.

title="WELCOME"
rows=3
text="Welcome to my application.
I hope you enjoy yourself
while you are using it."

Text.welcome: a text frame definition file

The file Text.welcome defines a text frame and is named according to the conventions for text frame definition files. The title descriptor defines the title that will appear in the title bar of the text frame, in this case WELCOME. The rows descriptor defines the vertical size of the text frame in lines of text. The width of the frame in this example is determined by FMLI. The text descriptor defines the words that will be printed in the body of the text frame.

To execute this application, invoke fmli as follows:

   fmli Menu.sample
In this example, Menu.sample is specified as the initial frame to open. An initial frame is a frame that is opened as an argument to fmli when it is invoked. There can be more than one initial frame. All initial frames remain displayed in the work area as long as the application is running; that is, a user cannot close or cancel an initial frame.

Users can exit from any FMLI application by pressing <CTRL-j> or <CTRL-f> <c> to access the FMLI command line and entering exit. Users of the example application could also select exit from TOP MENU.

In the next section, this example application will serve to illustrate how an FMLI application appears to users. If you want to supplement the discussion with a hands-on example, you can create copies of Menu.sample and Text.welcome in your file system and invoke fmli as shown above.


Next topic: Writing an internationalized application
Previous topic: Internationalization support

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