home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
CLIPPER
/
SCRNUZ
/
MEMSPROC.PRG
< prev
next >
Wrap
Text File
|
1992-04-29
|
5KB
|
150 lines
*----------------------------------------------------------------------------
*
* Program Name: MEMSPROC.PRG Copyright: EDON Corporation
* Date Created: 02/24/91 Language: Clipper S'87
* Time Created: 11:08:43 Author: Ed Phillips
* Description: Write Source Code for a Screen Procedure.
*----------------------------------------------------------------------------
PROCEDURE MakScrnCode
PRIVATE fname, pname, l, workbuff, oldcolor, gname, prom1, prom2, prom3
SET DELETED ON
oldcolor = Setcolor(c_statln1)
fname = Space(20)
sname = Space(4)
gname = Space(4)
IF Eof()
Sayerr('Screen.dbf is empty')
RETURN
ENDIF && IF Eof()
SELECT ScrnGets
SEEK Scr_file->Scrn_name
SELECT Scr_file
prom1 = ' Enter Name of File to Create:'
prom2 = ' Enter Name of Screen Procedure to Create:'
prom3 = ' Enter Name of Get Procedure to Create: '
l = Centr(prom1,20)
Shadow(2,l-1,6,l+51)
Scroll(2,l-1,6,l+51,0)
@ 2,l-1 TO 6, l+51
@ 2,l+16 SAY " Write Clipper S'87 Code "
@ 03,l SAY prom1 GET fname
@ 04,l SAY prom2 GET sname
IF ! ScrnGets->(Eof())
@ 05,l SAY prom3 GET gname
ENDIF && IF ! ScrnGets->(Eof())
READ
IF ! Empty(fname)
l = 0
@ 07,20 SAY ' WORKING.... '
SET PRINTER TO (fname)
SET DEVICE TO PRINT
@ Prow(),0 SAY '* Program: '+fname
*-------------------------
* Write the SCREEN Routine
*-------------------------
IF ! Empty(sname)
l = 3
@ Prow()+2,0 SAY 'PROCEDURE '+Trim(sname)+'_scrn'
ENDIF
@ Prow()+1,l SAY 'Setcolor(c_field)'
@ Prow()+1,l SAY 'Scroll('+Strzero(St,2,0)+','+Strzero(Sl,2,0)+','+;
Strzero(Sb,2,0)+','+Strzero(Sr,2,0)+',0)'
@ Prow()+2,l+12 SAY '* 1 2 3 4 5 6 7'
@ Prow()+1,l+12 SAY '*01234567890123456789012345678901234567890123456789012345678901234567890123456789'
@ Prow()+1,l SAY ''
width = Sr - Sl + 1
num_ln = Sb - St + 1
k = 1
FOR i = 1 TO num_ln
pline = ' '
FOR j = 1 TO width
pline = pline + Subs(Screen,k,1)
k = k + 2
NEXT && FOR j = 1 TO char_cnt
IF ! Empty(pline)
@ Prow()+1,l SAY [@ ]+Strzero(St+i-1,2,0)+[,]+Strzero(Sl,2,0)+[ SAY "] + Subs(Trim(pline),2) + ["]
ENDIF && IF ! Empty(pline)
NEXT && FOR i = 1 TO num_ln
@ Prow()+1,0 SAY "RETURN"
*----------------------
* Write the GET routine
*----------------------
IF ! Empty(gname)
SELECT ScrnGets
rec = Recno()
@ Prow()+2,0 SAY 'PROCEDURE '+Trim(gname)+'_get'
@ Prow()+1,l SAY 'PARAMETERS mode'
@ Prow()+2,l SAY 'Setcolor(c_field)'
DO WHILE Scrn_name == Scr_file->Scrn_name .AND. ! Eof()
@ Prow()+1,l SAY '@ '+Strzero(G_row,2,0)+','+Strzero(G_col,2,0)+' GET '+Trim(G_var)
IF ! Empty(G_pic)
@ Prow(),Pcol() SAY ' PICT "'+Trim(G_pic)+'"'
ENDIF
SKIP
ENDDO && DO WHILE ! Eof()
GO rec
@ Prow()+1,l SAY 'READ'
@ Prow()+2,l SAY 'IF Lastkey() != 27'
@ Prow()+1,l SAY " IF mode = 'ADD'"
@ Prow()+1,l SAY ' APPEND BLANK'
@ Prow()+1,l SAY ' ENDIF'
@ Prow()+2,l SAY " Automem('REPL')"
@ Prow()+1,l SAY 'ENDIF'
@ Prow()+1,0 SAY 'RETURN'
*--------------
* SAY procedure
*--------------
@ Prow()+2,0 SAY 'PROCEDURE '+Trim(gname)+'_say'
@ Prow()+1,l SAY 'DO '+Trim(sname)+'_scrn'
@ Prow()+1,0 SAY ''
DO WHILE Scrn_name == Scr_file->Scrn_name .AND. ! Eof()
@ Prow()+1,l SAY '@ '+Strzero(G_row,2,0)+','+Strzero(G_col,2,0)+' SAY '+Trim(G_var)
IF ! Empty(G_pic)
IF (',' $ G_pic) .OR. ('@R' $ G_pic) .OR. ('Y' $ G_pic)
@ Prow(),Pcol() SAY ' PICT "'+Trim(G_pic)+'"'
ENDIF
ENDIF
SKIP
ENDDO && DO WHILE ! Eof()
GO rec
@ Prow()+1,0 SAY 'RETURN'
ENDIF && IF ! Empty(gname)
@ Prow()+1,0 SAY "* EOF: "+fname
SET DEVICE TO SCREEN
SET PRINTER TO
ENDIF && IF ! Empty(fname)
Setcolor(oldcolor)
Restscreen(1,0,24,79,buffer1)
SET DELETED OFF
RETURN
* EOF: Memsproc.prg