home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / ISCURSOR.ZIP / DEMOCUR.PRG < prev    next >
Encoding:
Text File  |  1988-06-18  |  5.0 KB  |  202 lines

  1. ***********************************************************************
  2. *-*
  3. *-*      Program: DEMOCUR.PRG
  4. *-*
  5. *-*      IsCursor() Function DEMO program
  6. *-*      Author: John Scott Prinke
  7. *-*              1976 Monday Drive
  8. *-*              Elgin, IL  60123
  9. *-*              (312)-888-3210
  10. *-*              Source BFH594
  11. *-*
  12. *-*      Entered into the Public Domain.
  13. *-*      No warranty expressed or implied.  Use at your own risk.
  14. *-*
  15. *-*      MAKEDEMO.BAT will compile and link CURDEMO
  16. *-*
  17. *-*      Technical comments in ISCURSOR.ASM
  18. *-*
  19. *-*      Document for your Clipper S'87 manual by:
  20. *-*          TYPE ISCURSOR.DOC >PRN
  21. *-*          for Epson or compatible printers
  22. *-*
  23. ***********************************************************************
  24.  
  25. public mdate, mname, ison
  26. mdate = date()
  27. mname = SPACE(25)
  28. ison = "Y"
  29.  
  30. DO WHILE .T.
  31.    setinpuc()
  32.    CLEAR SCREEN
  33.    instru()
  34.  
  35.    @ 2,20 SAY trim(mname)
  36.    @ 3,20 SAY "IsCursor() Function Demo"
  37.    IF ison = "Y"
  38.      @ 5,20 SAY "IsCursor Function ENABLED in F10 function"
  39.    ELSE
  40.      @ 5,20 SAY "IsCursor Function DISABLED in F10 function"
  41.    ENDIF
  42.    @ 3,70 SAY DTOC(mdate)
  43.    SET CURSOR OFF
  44.    @ 8,2 SAY "The cursor is set OFF"
  45.    INKEY(0)
  46.    DO CASE
  47.      CASE LASTKEY() = -9
  48.         whatever()
  49.      CASE  LASTKEY() = 27
  50.         EXIT
  51.      OTHERWISE
  52.    ENDCASE
  53.  
  54.  
  55.    IF IsCursor()
  56.       @ 8,40 SAY "Function says ON"
  57.    ELSE
  58.       @ 8,40 SAY "Function says OFF"
  59.    ENDIF
  60.    INKEY(0)
  61.    DO CASE
  62.      CASE LASTKEY() = -9
  63.         whatever()
  64.      CASE  LASTKEY() = 27
  65.         EXIT
  66.      OTHERWISE
  67.    ENDCASE
  68.  
  69.    SET CURSOR ON
  70.    @ 10,2 SAY "The cursor is set ON"
  71.  
  72.    INKEY(0)
  73.    DO CASE
  74.      CASE LASTKEY() = -9
  75.         whatever()
  76.      CASE  LASTKEY() = 27
  77.         EXIT
  78.      OTHERWISE
  79.    ENDCASE
  80.  
  81.  
  82.    IF IsCursor()
  83.       @ 10,40 SAY "Function says ON"
  84.    ELSE
  85.       @ 10,40 SAY "Function says OFF"
  86.    ENDIF
  87.    INKEY(0)
  88.    DO CASE
  89.      CASE LASTKEY() = -9
  90.         whatever()
  91.      CASE  LASTKEY() = 27
  92.         EXIT
  93.      OTHERWISE
  94.    ENDCASE
  95. ENDDO
  96. CLEAR SCREEN
  97. IF .NOT. iscursor()
  98.   giveback = "Y"
  99.   @ 2,1 SAY "D:\CLIPPER>"
  100.   inkey(3)
  101.   clear type
  102.   tone(277,2)
  103.   @ 4,5 SAY "How do you like the prompt without the cursor ???"
  104.   inkey(1)
  105.   clear type
  106.   @ 10,07 SAY "You have exited the program with the CURSOR OFF. (I can tell now)."
  107.   @ 11,07 SAY "If you are going to DEBUG to check memory at 0000:0460, GREAT!"
  108.   @ 12,07 SAY "If you're planning on doing anything else, the cursor is real handy."
  109.   @ 15,07 SAY "Do you want me to give it back to you (Y/N) ?  " GET giveback picture "@!" valid (giveback $ "YN")
  110.   clear type
  111.   read
  112.   IF giveback = "Y"
  113.     set cursor on
  114.   ENDIF
  115.   CLEAR SCREEN
  116. ENDIF
  117. QUIT
  118.  
  119. ****************** FUNCTIONS *************************************
  120.  
  121.  
  122. FUNCTION setinpuc
  123. IF ISCOLOR()
  124.    SET COLOR TO GR+/B,W+/GR,N,,W+/N
  125.    * Yellow on blue   white on brown   unselected is white on black
  126. ELSE
  127.    *     {Monochrome}
  128.    SET COLOR TO W/N,N/W,N,,N/W,,u/W
  129. ENDIF
  130. RETURN "T"
  131.  
  132.  
  133. FUNCTION instru
  134. IF ISCOLOR()
  135.    SET COLOR TO W+/R,W+/R,N
  136.    * white on red
  137. ELSE
  138.    SET COLOR TO N/W,W/N,N
  139. ENDIF
  140. @ 23, 02 SAY "     Esc - Exit         Enter - Continue      F10 - Whatever Function      "
  141. IF ison = "Y"
  142.    @ 24, 02 SAY " Whatever gets the data with the cursor on and returns the cursor properly "
  143. ELSE
  144.    SETINPUC()
  145.    @ 24, 02 SAY " Whatever gets the data with the cursor on and always returns the cursor ON"
  146. ENDIF
  147. setinpuc()
  148. RETURN "T"
  149.  
  150.  
  151. FUNCTION WHATEVER
  152.   *-* Get the cursor status on entry
  153.   cur_stat = IsCursor()
  154.   save screen to mscr
  155.  
  156.   *-* WHATEVER function code
  157.        @ 14-1, 0 clear
  158.        * black shadow behind square
  159.        SET COLOR TO N/N,N/N,N
  160.        @ 14-1, 15-2 clear TO 19, 20
  161.        @ 14-1, 15-2 clear TO 14, 65
  162.        IF ISCOLOR()
  163.          SET COLOR TO N/W,W+/GR,N,,W+/N
  164.          * Black on white  white on yellow
  165.        ELSE
  166.          *    {Monochrome}
  167.          SET COLOR TO W/N,N/W,N
  168.        ENDIF
  169.        * Black on white  white on yellow
  170.        @ 14, 15 clear TO 19+1,65+1
  171.        set cursor on
  172.        @ 14, 20 SAY " WHATEVER FUNCTION"
  173.        @ 16, 20 SAY "Date : " GET mdate
  174.        @ 17, 20 SAY "Name : " GET mname
  175.        @ 18, 20 SAY "IsCursor ON (Y/N) :" GET ison picture "@!" valid (ison $ "YN")
  176.        read
  177.        IF ison = "N"
  178.          set cursor off
  179.          @ 19, 20 SAY "Try F10 after the cursor is set off"
  180.          inkey(0)
  181.          set cursor on
  182.        ENDIF
  183.        SETINPUC()
  184.        restore screen from mscr
  185.        IF ison = "Y"
  186.          @ 5,20 SAY "IsCursor Function ENABLED in F10 function"
  187.          INSTRU()
  188.        ELSE
  189.          @ 5,20 SAY "IsCursor Function DISABLED in F10 function"
  190.          INSTRU()
  191.        ENDIF
  192.  
  193.  
  194.   *-* Reset the cursor status on exit
  195.   IF .NOT. cur_stat .and. ison = "Y"       && ".and. ison..." only for demo
  196.      SET CURSOR OFF
  197.   ENDIF
  198.  
  199. RETURN "T"
  200.  
  201. *-* EOF: DEMOCUR.PRG
  202.