home *** CD-ROM | disk | FTP | other *** search
- // Copyright 1992 Robert Greenlee
- // This demo contains some code from Rick Spence's Clipper Programming Guide
- // book. This is a demo of the showansi function in the ansiclip.prg file.
- // You can compile/link this however you like, CL ansidemo works for me,
- // or you could do something like this:
- //
- // Clipper ansidemo
- // RTLINK file ansidemo lib clipper
- //
- // or you might do something like this:
- //
- // Clipper ansidemo /m/w/a
- // Clipper ansiclip /m/w/a
- // Rtlink file ansidemo,ansiclip lib clipper
- //
- local keypress,num_elems,elem_num,elem1,elem2,lchoffset,nts
- private nmimport
- #include "inkey.ch"
- IF .f.
- DO ansiclip // This will compile/link the function. It would be best
- // to get rid of this DO if you use the second compile/link
- // method above - otherwise you get a warning message.
- ENDI
- RELEASE arrtem // the current directory....
- DECLARE arrtem[ADIR("*.ANS")]
- ADIR("*.ANS",arrtem)
- num_elems := len(arrtem)
- FOR elem_num = 1 TO num_elems
- arrtem[elem_num] = STRTRAN(arrtem[elem_num]+SPAC(12-len(arrtem[elem_num])),'.ANS','')
- NEXT
- ASORT(arrtem,,,{|elem1,elem2| uppe(elem1) < uppe(elem2) })
- keypress=1
- DO WHIL keypress<>0 .AND. LASTKEY()<>K_ESC
- @ 3,20 CLEAR TO 22,34
- @ 3,20 TO 22,34
- IF keypress > 7
- lchoffset = 8
- ELSE
- lchoffset = 0
- ENDI
- keypress=achoice(4,21,21,33,arrtem,,,keypress,lchoffset)
- IF keypress<>0 .AND. LASTKEY()<>K_ESC
- nmimport=LTRIM(TRIM(arrtem[keyPress]))
- IF !'.ANS' $ nmimport
- nmimport = nmimport + '.ANS'
- ENDI
- nts=memoread("&nmimport")
- @ 0,0 CLEAR TO MAXROW(),MAXCOL()
- SET CURSOR OFF
- SHOWANSI(nts)
- SET CONS OFF
- WAIT
- SET CONS ON
- keypress++
- ENDIF
- ENDD
-
-