Menus Input

+-------------------------------------------------------------------------------------------+
|CALL  IGMENU (MN,CHTIT,*X1*,*X2*,*Y1*,*Y2*,NBU,CHUSER,N,CHITEM, CHDEF,CHVAL*,ICHOIC*,CHOPT) |
+-------------------------------------------------------------------------------------------+
                                  
Action: This routine displays a menu and returns the user's choice in the variable ICHOIC according to the option chosen. This routine works only on one menu: the menu management must be performed by the application program but this routine provides some facilities to manage several menus simultaneously. Parameter Description:
MN
Menu number. To use segment capabilities of the workstation. If MN=0 the segments are not used.
CHTIT
Menu title.
X1
X coordinate of lower left hand corner of menu box
Y1
Y coordinate of lower left hand corner of menu box
X2
X coordinate of upper right hand corner of menu box
Y2
Y coordinate of upper right hand corner of menu box
NBU
Number of User squares.
CHUSER
CHARACTER array of length NBU containing the text in the users' squares. The last line of the menu is split into NBU boxes.
N
Number of items.
CHITEM
CHARACTER array of length N containing the text for the items.
CHDEF
CHARACTER array of length N containing the text for the parameters. If CHOPT='P' the menu is split into two columns. The left column contains the items and the right column the default value of the corresponding item. CHDEF(I) (1 is a character string which contains the possible values of the item number I: CHDEF(I)='value1, value2, value3,..., valueN'. If CHDEF(I)=' ' there are no default values.
CHVAL*
CHARACTER array of length N into which parameter values are written. If CHOPT='P' then CHVAL(I) contains the parameter value for item I.
ICHOIC
Choice number. The description of the possible values returned in ICHOIC is given in the following table:
           +-+---------+------------------------------------+-+
           +-+----0----+-Outside-of-the-menu----------------+-+
           +-+---100---+-Title-bar--------------------------+-+
           +-+--1,NBU--+-User-keys--------------------------+-+
           +-+---1000--+-Right-button-of-the-mouse-clicked--+-+
           | |   >0    | Item number                        | |
           +-+---------+------------------------------------+-+
                                  
CHOPT
CHARACTER variable specifying the option(s) selected.
The square at the left of the title bar moves and resizes the menu. The square at the right of the title bar moves the menu.

+-+------+--------------------------------------------------------------------+-+
| | 'H'  | The picked item is highlighted. The last choice number must be     | |
+-+------+-given-in-ICHOIC.---------------------------------------------------+-+
+-+-'D'--+-Display-the-menu.--------------------------------------------------+-+
+-+-'C'--+-Permit-a-choice-in-the-displayed-menu.-----------------------------+-+
+-+-'E'--+-Erase-the-menu.----------------------------------------------------+-+
| | 'P'  | The menu is a menu with parameters.                                | |
+-+-'R'--+-Return-the-current-position-of-the-menu-in-X1,X2,Y1,Y2.---+-+
+-+------+--------------------------------------------------------------------+-+
+-+-'S'--+-Software-characters-are-used-to-draw-the-text-in-the-menu.---------+-+
| | 'U'  | Update the user text in the user squares with the value in         | |
| |      | CHUSER. The user square number is given in ICHOIC. The    | |
| |      | options 'U' and 'H' are incompatible because they used both        | |
+-+------+-ICHOIC-as-input-parameter.-----------------------------------------+-+
+-+-'M'--+-Menu-drawn-on-a-Metafile.------------------------------------------+-+
+-+-'Z'--+-Menu-stored-in-the-ZEBRA-picture.----------------------------------+-+
| | 'N'  | The last input position is used to find the menu item. With this   | |
| |      | option choices can be made in several menus at the same time       | |
| |      | using a DO loop as shown below. NBMENU is the    | |
| |      | number of menus on the screen.                                     | |
+-+-'B'--+-A-rubberbanding-box-is-used-for-the-locator.-----------------------+-+
+-+------+--------------------------------------------------------------------+-+
| | 'T'  | The title bar is not drawn, then the menu can not be moved         | |
+-+------+-interactively.-----------------------------------------------------+-+
+-+-'W'--+-The-menu-is-drawn-with-Width.--------------------------------------+-+
+-+-'A'--+-The-menu-is-drawn-with-shAdow.-------------------------------------+-+
+-+-'V'--+-Draw-only-the-vertical-part-of-width-or-shadow.--------------------+-+
| | 'O'  | Like option 'V' but the width or shadow is aligned on the menu     | |
| |      | frame.                                                             | |
+-+-'I'--+-Input-menu.-A-parameter-menu-is-displayed-and- IGMENU-is-entered----+-+
| |      | directly in request string. This is useful to perform a request    | |
| |      | string without a very complicated initialization part.             | |
+-+------+--------------------------------------------------------------------+-+
+-+-'K'--+-Key-menu.-The-user-keys-are-drawn-as-key.--------------------------+-+

Table: Options for IGMENU

[tab-IGMENU]

Example

This example program shows how IGMENU can manage several menus at the same time.
                    How to manage several menus
                                  
      PROGRAM MENU
*
      COMMON /PAWC/H(50000)
      PARAMETER (NBMENU=3)
      CHARACTER*10 CHU, CHI, CHD, CHV, CHTIT, CHOPT
      CHARACTER*80 TEXT
      CHARACTER*16 CHLOC(3)
      DIMENSION CHU(3),NBU(NBMENU),NBI(NBMENU)
      DIMENSION CHI(3),CHD(3),CHV(3),CHTIT(NBMENU)
      DIMENSION X1(NBMENU),X2(NBMENU),Y1(NBMENU),Y2(NBMENU)
*     Last choice in the menu NB i (useful for HIghligth)
      DIMENSION ICCH(NBMENU)
      DATA CHU /'Quit','Exit','GED'/
      DATA CHI /'Choice 1', '|Choice 2', 'Choice 3'/
*.______________________________________
*
*
*       Initialize HIGZ
*
      CALL MZEBRA(-3)
      CALL MZPAW(50000,' ')
      CALL IGINIT(0)
      CALL IGWKTY(KWKTYP)
      CALL IGSSE(6,KWKTYP)
      CALL ISELNT(0)
      CALL MESSAGE('Example of the IGMENU usage in multiple input')
*
*       Initialize and display menu number 1
*
  1   ICCH(1)=0
      X1(1)=0.14
      X2(1)=0.35
      Y1(1)=0.1
      Y2(1)=0.25
      NBU(1)=2
      NBI(1)=3
      CHTIT(1)='MENU 1'
      CALL IGMENU (0,CHTIT(1),X1(1),X2(1),Y1(1),Y2(1),NBU(1),CHU,
     +             NBI(1),CHI,CHD,CHV,ICH,'S   D')
*
*       Initialize and display menu number 2
*

      ICCH(2)=0
      X1(2)=0.3
      X2(2)=0.56
      Y1(2)=0.3
      Y2(2)=0.45
      NBU(2)=2
      NBI(2)=3
      CHTIT(2)='MENU 2'
      CALL IGMENU (0,CHTIT(2),X1(2),X2(2),Y1(2),Y2(2),NBU(2),CHU,
     +             NBI(2),CHI,CHD,CHV,ICH,'S   D')
*
*       Initialize and display menu number 3
*
      ICCH(3)=0
      X1(3)=0.05
      X2(3)=0.95
      NBU(3)=3
      NBI(3)=0
      CHTIT(3)='MENU 3'
      Y1(3)=0.9
      Y2(3)=0.935
      CALL IGMENU (0,CHTIT(1),X1(3),X2(3),Y1(3),Y2(3),NBU(3),CHU,
     +             NBI(3),CHI,CHD,CHV,ICH,'ST  D')
*
*       Initialize the current menu number
*
      IMENU=3
*
*       Request in the current menu
*
   10 CONTINUE
      IF(IMENU.LT.3)THEN
         CHOPT='S   CR'
      ELSE
         CHOPT='ST  C'
      ENDIF
      ICH=ICCH(IMENU)
      CALL IGMENU (0,CHTIT(IMENU),X1(IMENU),X2(IMENU),
     +             Y1(IMENU),Y2(IMENU),NBU(IMENU),CHU,
     +             NBI(IMENU),CHI,CHD,CHV,ICH,CHOPT)
*
*       If the choice is outside the menu (ICH=0), we search here
*       if the input is in an other menu (CHOPT='N')
*
      IF(ICH.EQ.0)THEN
         DO 20  I=1,NBMENU
            IF(I.LT.3)THEN
               CHOPT='S CRN'
            ELSE
               CHOPT='SCTNKU'
            ENDIF
            ICH=ICCH(I)
            CALL IGMENU (0,CHTIT(I),X1(I),X2(I),Y1(I),Y2(I),

     +                   NBU(I),CHU,
     +                   NBI(I),CHI,CHD,CHV,ICH,CHOPT)
            IF(ICH.NE.0)THEN
               IMENU=I
               GOTO 30
            ENDIF
   20    CONTINUE
*
*       After the DO loop the input is outside all menus
*
         CALL MESSAGE('Outside the menus')
         GOTO 10
      ENDIF
      ICCH(IMENU)=ICH
*
*       Analyses the result
*
   30 CONTINUE
      IF(ICH.GT.0)THEN
         WRITE(TEXT,'(''Menu : '',I1,'', choice : '',I1)')IMENU,ICH
         CALL MESSAGE(TEXT)
         GOTO 10
      ENDIF
      IF(ICH.EQ.-100)THEN
         WRITE(TEXT,'(''Menu : '',I1,'', title bar'')')IMENU
         CALL MESSAGE(TEXT)
         GOTO 10
      ENDIF
      IF(ICH.EQ.-1000)THEN
         CALL MESSAGE('Right button of the mouse')
         GOTO 10
      ENDIF
      IF(ICH.EQ.-1)THEN
         WRITE(TEXT,'(''QUIT from menu : '',I1)')IMENU
         CALL MESSAGE(TEXT)
         CALL IGEND
         GOTO 999
      ENDIF
      IF(ICH.EQ.-2)THEN
         WRITE(TEXT,'(''EXIT from menu : '',I1)')IMENU
         CALL MESSAGE(TEXT)
         CALL IGEND
         GOTO 999
      ENDIF
      IF(ICH.EQ.-3)THEN
         CALL MESSAGE('Invoke the Graphics Editor')
         CALL IZPICT('*','S')
         CALL IZPICT('P1','M')
         CALL IGRNG(20.,20.)
         CALL IZGED('P1','S')
         GOTO 1
      ENDIF
      IF(ICH.LT.0)THEN

        WRITE(TEXT,'(''Menu : '',I1,'', choice : '',I2)')IMENU,ICH
         CALL MESSAGE(TEXT)
         GOTO 10
      ENDIF
*
  999 END
      SUBROUTINE MESSAGE(TEXT)
      CHARACTER*(*) TEXT
      CALL IGZSET('G')
      CALL ISELNT(0)
      CALL IGSET('FACI',0.)
      CALL IGSET('FAIS',1.)
      CALL IGSET('BORD',1.)
      CALL IGBOX(0.,1.,0.,0.04)
      CALL IGSET('TXAL',23.)
      CALL IGSET('CHHE',0.02)
      CALL IGSET('TXFP',-100.)
      CALL ITX(0.5,0.02,TEXT)
      call iuwk(0,0)
      END