home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / xbase / library / clipper / ansisys / ansidemo.prg < prev   
Encoding:
Text File  |  1992-01-28  |  1.8 KB  |  59 lines

  1. // Copyright 1992 Robert Greenlee
  2. // This demo contains some code from Rick Spence's Clipper Programming Guide
  3. // book.  This is a demo of the showansi function in the ansiclip.prg file.
  4. // You can compile/link this however you like,  CL ansidemo works for me,
  5. // or you could do something like this:
  6. //
  7. //                Clipper ansidemo
  8. //                RTLINK file ansidemo lib clipper
  9. //
  10. // or you might do something like this:
  11. //
  12. //                Clipper ansidemo /m/w/a
  13. //                Clipper ansiclip /m/w/a
  14. //                Rtlink file ansidemo,ansiclip lib clipper
  15. //
  16. local keypress,num_elems,elem_num,elem1,elem2,lchoffset,nts
  17. private nmimport
  18. #include "inkey.ch"
  19. IF .f.
  20.   DO ansiclip   // This will compile/link the function.  It would be best
  21.                 //  to get rid of this DO if you use the second compile/link
  22.                 //  method above - otherwise you get a warning message.
  23. ENDI
  24. RELEASE arrtem         // the current directory....
  25. DECLARE arrtem[ADIR("*.ANS")]
  26. ADIR("*.ANS",arrtem)
  27. num_elems := len(arrtem)
  28. FOR elem_num = 1 TO num_elems
  29.   arrtem[elem_num] = STRTRAN(arrtem[elem_num]+SPAC(12-len(arrtem[elem_num])),'.ANS','')
  30. NEXT
  31. ASORT(arrtem,,,{|elem1,elem2| uppe(elem1) < uppe(elem2) })
  32. keypress=1
  33. DO WHIL keypress<>0 .AND. LASTKEY()<>K_ESC
  34.   @ 3,20 CLEAR TO 22,34
  35.   @ 3,20 TO 22,34
  36.   IF keypress > 7
  37.     lchoffset = 8
  38.   ELSE
  39.     lchoffset = 0
  40.   ENDI
  41.   keypress=achoice(4,21,21,33,arrtem,,,keypress,lchoffset)
  42.   IF keypress<>0 .AND. LASTKEY()<>K_ESC
  43.     nmimport=LTRIM(TRIM(arrtem[keyPress]))
  44.     IF !'.ANS' $ nmimport
  45.       nmimport = nmimport + '.ANS'
  46.     ENDI
  47.     nts=memoread("&nmimport")
  48.     @ 0,0 CLEAR TO MAXROW(),MAXCOL()
  49.     SET CURSOR OFF
  50.     SHOWANSI(nts)
  51.     SET CONS OFF
  52.     WAIT
  53.     SET CONS ON
  54.     keypress++
  55. ENDIF
  56. ENDD
  57.  
  58.  
  59.