Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>multi_form() multiple-page format screens apndxj.prg</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Multi_form()   Multiple-page format screens            Apndxj.prg


Syntax:        Multi_form(<array>)

Argument:      <array> is an array of screen names passed as
               character strings.

Returns:       The index of the current screen in the <array> of
               screens.

Description:   Multi_form() is a general purpose format paging routine.
               It can, however, be used to emulate multiple-screen
               format files supported by dBASE III PLUS.

               To use Multi_form(), first create an array filling it
               with the names of the format procedures in the order you
               want them executed.  Multi_form() pages forward between
               format screens when the last GET in a format terminates.
               PgUp and PgDn move forward or backward one screen.  Esc
               terminates Multi_form() returning the position in the
               array of the last format screen processed.


----------------------------------- Example --------------------------------

   DECLARE arry[2]

   arry[1] = "Customers"
   arry[2] = "Invoices"

   lastpage = Multi_form(arry)


--------------------------------- Source Code ------------------------------

   FUNCTION Multi_form

   PARAMETERS scr_arry
   PRIVATE pg_count, form

   maxpage  = LEN(scr_arry)
   pg_count = 1
   DO WHILE .T.

      CLEAR
      form = scr_arry[pg_count]
      SET FORMAT TO &form.
      READ

      DO CASE
      CASE LASTKEY() = 27
         *
         * Esc key.
         EXIT
      CASE LASTKEY() = 18
         *
         * PgUp key.
         IF pg_count > 1
            pg_count = pg_count - 1
         ELSE
            EXIT
         ENDIF
      OTHERWISE
         *
         * Any other key.
         IF pg_count < maxpage
            pg_count = pg_count + 1
         ELSE
            EXIT
         ENDIF
      ENDCASE

   ENDDO

   RETURN pg_count


See Also: SET FORMAT

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson