PreviousNextIndex

CHOOSE statement

After you display data, the CHOOSE statement moves a highlight bar among a series of choices and selects a choice when you press GO, RETURN, or enter a unique combination of initial characters.

This statement is supported only for backward compatibility.

Note: Does not apply to SpeedScript programming.
Syntax

CHOOSE 
  {     { ROW field [ HELP char-constant ] } 
     |  { FIELD { field [ HELP char-constant ] } ... } 
  } 
  [ AUTO-RETURN ] [ COLOR color-phrase ] 
  [ GO-ON ( key-label ... ) ] [ KEYS char-variable ] 
  [ NO-ERROR ] [ PAUSE expression ] 
  { [ frame-phrase ] } 

You can specify the AUTO-RETURN, COLOR, GO-ON, KEYS, NO-ERROR, and PAUSE options in any order.

ROW field
FIELD field
HELP char-constant
AUTO-RETURN
COLOR color-phrase
GO-ON ( key-label ) . . .
KEYS char-variable
NO-ERROR
PAUSE expression
frame-phrase
Example

The following procedure displays a strip menu with four choices. The procedure defines two arrays; one holds the items for selection on the menu, the other 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. The AVM finds the number (within the array) associated with the item selected and the program associated with that number in the proglist array. The AVM runs the program, if it exists, and displays a message. It also allows the user to select another item if the program does not exist. (In your own application, you associate actions with items selected by the CHOOSE statement.)

r-chsmnu.p
DEFINE VARIABLE menu     AS CHARACTER NO-UNDO EXTENT 4 FORMAT "x(7)" 
  INITIAL [ "Browse", "Create", "Update", "Exit" ]. 
DEFINE VARIABLE proglist AS CHARACTER NO-UNDO 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 10. 
REPEAT: 
  VIEW FRAME instruc. 
  DISPLAY menu WITH NO-LABELS ROW 21 NO-BOX ATTR-SPACE 
    FRAME f-menu CENTERED. 
  HIDE MESSAGE. 
  CHOOSE FIELD menu GO-ON (F5) 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. 

The GO-ON option sets the GET key to perform an action like GO. With the LASTKEY function, you could check for F5 and take another action relevant to your application.

Notes
See also

COLOR phrase, Frame phrase, SCROLL statement, STATUS statement


OpenEdge Release 10.2B
Copyright © 2009 Progress Software Corporation
PreviousNextIndex