home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / VSCROLL.PRG < prev    next >
Encoding:
Text File  |  1991-06-28  |  2.4 KB  |  72 lines

  1. /*
  2.     Program: VSCRNSCRL()
  3.     System:  GRUMPFISH LIBRARY
  4.     Author:  Greg Lief
  5.     Copyright (c) 1988-90, Greg Lief
  6.     Clipper 5.x Version
  7.     Compile instructions: clipper vscroll /n/w/a
  8.  
  9.     Displays screen in vertical row-by-row increments
  10.  
  11.     NOTE: screen must be pre-saved to the <screen file> using
  12.     HBlindSave())
  13.  
  14.     Syntax: VSCRNSCRL(<screen file> [, <nDirection> ])
  15.  
  16.     Optional parameter <nDirection> determines whether the display
  17.     will be pull-down or pop-up.  Pass 1 for pop-up, -1 for pull-down.
  18.     (Default is pull-down.)  Thanks to Evan Davies for the suggestion!
  19.  
  20.     WILL HANDLE 25/43/50 ROW DISPLAYS
  21. */
  22.  
  23. //───── begin preprocessor directives
  24.  
  25. #include "fileio.ch"
  26. #include "grump.ch"
  27.  
  28. //───── end preprocessor directives
  29.  
  30. function VScrnScrl(cfile, ndirection)
  31. local maxrow := maxrow() + 1, maxcol := maxcol() + 1
  32. local handle, screen_[maxrow], buffer, xx, yy, bufflen := maxcol * 2
  33. local loopers_
  34. default ndirection to -1                // default is pull-down
  35. if file(cfile)
  36.    handle := fopen(cfile, FO_READ)
  37.    if handle != F_ERROR
  38.       //───── verify that this file was saved in the same mode that we are in
  39.       //───── because if it wasn't, all hell will break loose further down
  40.       if fseek(handle, 0, FS_END) == maxrow * maxcol * 2
  41.          buffer := space(bufflen)
  42.          fseek(handle, 0, FS_SET)       // reset to start of file
  43.          for xx = 1 to maxrow
  44.             fread(handle, @buffer, bufflen)
  45.             screen_[xx] := buffer
  46.          next
  47.          fclose(handle)
  48.          /*
  49.              load LOOPERS_ array based on direction -- structure is:
  50.                   LOOPERS_[1] := starting row for FOR..NEXT loop
  51.                   LOOPERS_[2] := ending row for FOR..NEXT loop
  52.                   LOOPERS_[3] := row to be displayed within loop
  53.          */
  54.          if ndirection == 1                     // pop-up
  55.             loopers_ := { 1, maxrow, maxrow }
  56.          else                                   // pull-down
  57.             loopers_ := { maxrow, 1, 0 }
  58.          endif
  59.          for xx = loopers_[1] to loopers_[2] step ndirection
  60.             scroll(0, 0, maxrow, maxcol, ndirection)
  61.             restscreen(loopers_[3], 0, loopers_[3], maxcol, screen_[xx])
  62.          next
  63.       endif
  64.    endif
  65. endif
  66. return NIL
  67.  
  68. * end function VScrnScrl()
  69. *--------------------------------------------------------------------*
  70.  
  71. * eof vscroll.prg
  72.