Newsgroups: bit.listserv.vm-util
Date:         Mon, 13 Apr 1992 08:24:19 EST
From:         "Scott Mattes" <COTRSSM@SEA04VM.NAVSEA.NAVY.MIL>
Subject:      Re: VmShare
Comments: To: VM Utilities Discussion List <VM-UTIL@OHSTVMA.ACS.OHIO-STATE.EDU>
              12 Apr 1992 00:00:20 EDT from
              <057504%ACADVM1.UOTTAWA.CA@OHSTVMA.ACS.OHIO-STATE.EDU>

On Sun, 12 Apr 1992 00:00:20 EDT Costa Karamalis said:
>3) Also is there a way to have menus, where you go with the cursor and
>press enter to choose the selection? Or to know in any time where the
>cursor is?

:READ XXEDMENU XEDIT
/**-------------------------------------------------------------**/
/**------------------------ I-NET, Inc. ------------------------**/
/**---------------------------- for ----------------------------**/
/**--------------- the Naval Sea Systems Command----------------**/
/**-------------------------------------------------------------**/
/* Created by:          On:         Reason:                      */
/* Scott (nmi) Mattes   11 May 1989 Initial creation             */
/*                                                               */
/* Purpose:                                                      */
/*                                                               */
/* A demo of using XEDIT as a simple panel driver.               */
/*                                                               */
/* Invoke as 'XEDIT $ $ A ( NOMSG PROFILE XXEDMENU               */
/*                                                               */
/* External routines:   Purpose:                                 */
/*                                                               */
/* REXXERR  EXEC        Displays information on error conditions */
/*                                                               */
/* Modified by:         On:         Reason:                      */
/* Scott (nmi) Mattes   16 Sep 1991 Explain your changes here    */
/*                                                               */
/**-------------------------------------------------------------**/

  Signal on Halt
  Signal on Syntax                   /* Establish error routines */

  Arg parms '(' options
  If Word(parms,1) = '?' Then Call Explain   /* Want short help? */

Begin:            /**--- Enter your REXX code after this line ---*/
  Do z = 1 to 24
     'set pf'z
  End /* Do */

  'SET PF09 HELP CMS GDDM'
  'SET PF12 E'

  'SET RESERVE 1 NOH '             /* Things that we don't want */
  'SET PRE OFF'
  'SET TOFEOF OFF'
  'SET MSGL OFF'
  'SET MSGL ON -2 1'
  'SET CMDL OFF'
  'SET CURL ON 1'
  'SET SCALE OFF'

  'DEL *'                            /* Make sure file is empty */
  'SET MSGM ON'
                        /* This next must be before the CTLCHAR */
  'SET CASE M I'        /* So our text looks like we type it in */

  'SET CTLCHAR %   ESCAPE'    /* Control characters for display */
  'SET CTLCHAR P   PROTECT PINK  NONE NOHIGH'
  'SET CTLCHAR p   PROTECT PINK  NONE NOHIGH'
  'SET CTLCHAR G   PROTECT GREEN NONE NOHIGH'
  'SET CTLCHAR g   PROTECT GREEN NONE NOHIGH'
  'SET CTLCHAR R   PROTECT RED   NONE NOHIGH'
  'SET CTLCHAR r NOPROTECT RED   NONE NOHIGH'
  'SET CTLCHAR W   PROTECT WHITE NONE HIGH'
  'SET CTLCHAR w NOPROTECT WHITE NONE HIGH'
  'SET CTLCHAR T   PROTECT TURQ  NONE HIGH'
  'SET CTLCHAR t NOPROTECT TURQ  NONE HIGH'
  'SET CTLCHAR Y   PROTECT YEL   NONE HIGH'
  'SET CTLCHAR y NOPROTECT YEL   NONE HIGH'
  'SET CTLCHAR B   PROTECT BLUE  NONE HIGH'
  'SET CTLCHAR b NOPROTECT BLUE  NONE HIGH'

/******************************************************************
*                                                                 *
* Lines on the screen that will not ever change                   *
*                                                                 *
******************************************************************/
  'SET RESERVE  1 RED   NOH' center('G D D M selection menu',80)
  'SET RESERVE  9 WHITE NOH          ' ,
                          'Please select one of the following functions:'
  'SET RESERVE 11 WHITE NOH           1.%YCHART           ' ,
                            ':%B Use the Interactive Chart Utility'
  'SET RESERVE 12 WHITE NOH           2.%YISE             '  ,
                            ':%B Use the Image Symbol Editor'
  'SET RESERVE 13 WHITE NOH           3.%YVSE             ' ,
                            ':%B Use the Vector Symbol Editor'
  'SET RESERVE 14 WHITE NOH           4.%YLINK            ' ,
                            ':%B Link the software MDISK and exit'
  'SET RESERVE 17 WHITE NOH           E.%YEXIT%B'

  'SET RESERVE -1 BLUE  NOH' right('%WPF9%BHelp PF12 Quit',79)

/******************************************************************
*                                                                 *
* Main body of macro, loop till they can't take it any longer     *
*                                                                 *
******************************************************************/
  D1 = "1"                               /* Value of input field */
  LD1 = 1                       /* Default length of input field */

  DO UNTIL D1 = 'E' /* This is the only input field in the panel */

     'SET ENTER' D1     /* The default if no data keyed in panel */

/******************************************************************
*                                                                 *
* Lines on the screen that change each time key is pressed.       *
*                                                                 *
******************************************************************/
     'SET RESERVE  7 BLUE  NOH           DATE:%Y'date()'%B' ,
                              '                           TIME:%Y'time()
     'SET RESERVE 20 WHITE NOH           Type function number and press',
                 ||           '%R<ENTER>%W ====>%b'left(D1,ld1)'%W'
     'SET RESERVE 22 BLUE  NOH' center('Release:%R'left(release,3)'%B',80)

     'CURSOR SCREEN 20 57'   /* Position cursor to the input field */

     'READ ALL NOTAG'   /* Return all changed fields w/o line tags */

/******************************************************************
*                                                                 *
* This is were we read the screen input. Only those fields that   *
* were changed will be stacked, with the first line being the key *
* that terminated the READ.                                       *
*                                                                 *
* Since we have only one input field in this panel, no special    *
* considerations, I just want the last stacked line.              *
*                                                                 *
******************************************************************/
     do queued()
       parse upper pull D1 .
     end

         SELECT
             WHEN D1 = ''
                  Then Do
                       d1 = 1
                       iterate
                       End
             WHEN D1 = 1 THEN say 'You chose number 1'
             WHEN D1 = 2 THEN say 'You chose number 2'
             WHEN D1 = 3 THEN say 'You chose number 3'
             WHEN D1 = 4 THEN say 'You chose number 4'
             WHEN D1 = 'HELP' THEN 'HELP CMS xedmenu ( NOTES'
             WHEN D1 = 'E' THEN iterate               /* Bye bye */
             OTHERWISE  do  /* Tell them they can't ask for that */
                        'EMSG' center("'"d1"'" 'is not a valid choice',79)
                        END
         END

  END
Exit:                           /**--- The one and only Exit ---**/
  'DROPBUF'                                          /* Clean up */
  'QQUIT'
  'VMFCLEAR'
  Exit

/**--- Procedures local to this EXEC ---**/
one:
two:
three:
  say 'You selected item' D1
  say ''
  say 'Press ENTER to continue.....'
  'cp sleep'
  'VMFCLEAR'
  'DROPBUF'
  'MAKEBUF'
return

/**--- Standard procedures useful in all EXECs ---**/
Yesno:
  Parse arg default question

  Call Cmstype('on')                   /* make sure they can see */

  If Find('Y Yes YES',default) <> 0 Then default = 1
  If Find('N No NO',default) <> 0 Then default = 0

  Do until ans = 0 | ans = 1    /* only way out is to answer y|n */
     If default
        Then Say question '( No|ENTER)'
        Else Say question '( Yes|ENTER)'
     Parse upper pull ans .

     Select
        When ans = ''         /* If ENTER only, selected default */
             Then If default
                     Then ans = 1
                     Else ans = 0
        When Find('Y Yes YES',ans) <> 0 Then ans = 1
        When Find('N No NO',ans) <> 0 Then ans = 0
        Otherwise Do                      /* Must choose Y or N! */
                  Say ''; Say 'Choose YES or NO only!'
                  End
     End /* Select */
  End /* Do */

  If ^rt Then Call Cmstype('off')          /* return the Cmstype */
  Return ans

Tracing:
  If Trace() = 'O' | Trace() = 'N'
     Then Return 0                          /* Tracing is not on */
     Else Return 1                              /* Tracing is on */

Scr_clear:
  If ^Tracing() Then 'VMFCLEAR'
  Return

Pause:
  Say ''                        /* Set this line off from others */
  d = '1d'x
  Say 'Press'd'8ENTER'd'0to continue'
  'CP SLEEP'
  Return

Cmstype:
  If Tracing() Then Return    /* Don't do if we are being traced */
  Parse upper arg type_cmd
  If rt <> 0 & rt <> 1                /* Set if never set before */
     Then rt = cmsflag('CMSTYPE')
  If type_cmd = 'OFF'
     Then do
          rt = Cmsflag('CMSTYPE')
         'SET CMSTYPE HT'
          end
  If type_cmd = 'ON' & rt
     Then 'SET CMSTYPE RT'
  Return

Cmscmd:
  Parse arg acmd
  Call Cmstype('off')
  Address cms acmd
  rtc = rc
  Call Cmstype('on')
  rc = rtc
  Return Rc

Halt:

Syntax:
  Parse source rexx_source
  Exit Rexxerr(rc,sigl,sourceline(sigl),rexx_source,parms)

Explain2:
  If Sigl < 20                    /* is this routine compressed? */
     Then Do                                /* yes, special case */
          helpline =  Sourceline(Sigl)
          helpline =  substr(helpline,lastpos('Explain2',helpline))
          parse value helpline with ';' help ';' helpline
          Do until help = ''
             interpret 'Say' help
             parse value helpline with help ';' helpline
          End /* Do */
          End
     Else do z = Sigl+1 to Sourceline()        /* no, no problem */
             interpret 'Say' Sourceline(z)
          end
  Exit 99

Explain:
  Signal Explain2            /* sets sigl variable to this line. */
"+--------------------------------------------------------------------+"
"|   FORMAT:                                                          |"
"|     +-----------+------------------------------------------------+ |"
"|     | XXEDMENU  |                                                | |"
"|     +-----------+------------------------------------------------+ |"
"|                                                                    |"
"| FUNCTION:                                                          |"
"|                                                                    |"
"|     To display the sample XEDIT menu.                              |"
"|                                                                    |"
"|     Invoke as 'XEDIT $ $ A ( NOMSG PROFILE XXEDMENU'               |"
"+--------------------------------------------------------------------+"

Scott       | No success can compensate for failure in the home. David O. McKay
Mattes      | President 1951-70, Church of Jesus Christ of Latter-day Saints
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU