Progress
Programming
Handbook


Strip Menus

A strip menu is a one-down frame that allows you to move a highlight bar between fields in an array or among fields in a table.

NOTE: Strip menus are supported for backwards compatibility. You can use buttons or menu widgets instead.

The following procedure sets up a simple strip menu:

p-strip.p
DEFINE VARIABLE abc AS character EXTENT 3
 INITIAL ["Add", "Update", "Delete"].

DISPLAY abc NO-LABELS WITH ROW 8 CENTERED
  TITLE "Customer Maintenance".
  
CHOOSE FIELD abc AUTO-RETURN.

IF FRAME-VALUE = "add" THEN MESSAGE "Add customer".
IF FRAME-VALUE = "update" THEN MESSAGE "Update customer".
IF FRAME-VALUE = "delete" THEN MESSAGE "Delete customer". 

This procedure produces the following output:

The p-strip.p procedure defines the array abc with an extent of 3 to display the selections on the menu. The CHOOSE statement allows you to move the highlight bar among the three fields in the array and to select a highlighted item by pressing RETURN. Progress displays a message based on the item CHOOSE holds in the frame. In your own application you can have Progress perform an action based on the item the user selects.

You can also use the CHOOSE statement to create a strip menu that appears at the bottom of the screen. The following procedure shows how you might do this:

p-chsmnu.p
DEFINE VARIABLE menu AS CHARACTER EXTENT 4 FORMAT "x(7)"
   INITIAL [ "Browse", "Create" , "Update", "Exit" ].

DEFINE VARIABLE proglist AS CHARACTER EXTENT 4
   INITIAL [ "brws.p", "cre.p", "upd.p", "exit.p"].

FORM "Use the sample strip menu to select an action."
  WITH FRAME instruc CENTERED ROW 5.

REPEAT:
   VIEW FRAME instruc.
   DISPLAY menu 
      WITH NO-LABELS ROW SCREEN-LINES - 2 NO-BOX FRAME f-menu CENTERED.
   HIDE MESSAGE.
   CHOOSE FIELD menu AUTO-RETURN WITH FRAME f-menu.
   IF SEARCH(proglist[FRAME-INDEX]) = ?
   THEN DO:
       MESSAGE "The program" proglist[FRAME-INDEX] "does not exist.".
       MESSAGE "Please make another choice.".
   END.
   ELSE RUN VALUE(proglist[FRAME-INDEX]).
END. 

This procedure produces the following output:

Use the arrow keys to move the highlight bar through the available selections and press RETURN when the bar highlights the selection you want. Because this is a sample procedure, none of the items perform actions other than returning messages.

Now look back at the p-chsmnu.p procedure. The procedure defines two arrays with an extent of four. The menu array holds the items for selection on the menu, and the proglist array holds the names of the programs associated with the menu selections. The CHOOSE statement allows the user to select an item from the strip menu. Progress finds the number in the menu array associated with the item, and then finds the program associated with the number in the proglist array. Progress runs the program if it exists. If it does not exist, Progress displays a message and allows the user to select another item from the strip menu.

In most cases, you use the SCROLL statement with the CHOOSE ROW statement to perform the actual work of selecting an item from a scrolling menu and taking an action based on that item.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095