Salvar screen
Enviado: 30 Mai 2012 17:59
qnd salvei, ele criou uma linha em branco...
Código: Selecionar todos
*--------------------------------------------------------------*
* RM_MVSAVE()
*--------------------------------------------------------------*
FUNCTION RM_MVSAVE()
LOCAL i := 0
LOCAL nForLoop := 0
LOCAL b := MAXROW()
LOCAL r := MAXCOL()
LOCAL cScreen := SAVESCREEN(0, 0, b, r) //
LOCAL nCellSize := INT( len( Savescreen( 0, 0, 0, 0 ) ) * 2 )
LOCAL nStart := 1
LOCAL nRange := INT( ( ( r + 1 ) * nCellSize ) * 1 )
LOCAL cSubString := ''
LOCAL cOutString := ''
For i := 1 To ( b + 1 )
cOutString := ''
cSubString := Substr( cScreen, nStart, nRange )
For nForLoop := 1 To nRange step nCellSize
cOutString += F_Tab_Ascii( Substr( cSubString, nForLoop, 1 ) )
Next
sAux += ( cOutString ) + CHR(13) + CHR(10)
nStart += nRange
Next
RETURN( cOutString )
*------------------------------------------*
* CARACTERES DESEJADOS NA TABELA ASCII
*------------------------------------------*
FUNCTION F_Tab_Ascii( cStr )
LOCAL i := 0
LOCAL cAux := ''
FOR i := 33 TO 180 // 33 ... 255
cAux += CHR( i )
NEXT
IF !( cStr $ cAux )
cStr := ' '
ENDIF
RETURN( cStr )
Código: Selecionar todos
FUNCTION COM_F10
SET ALTERNATE TO C:TELA.PRN
SET ALTERNATE ON
?? " Nome da empresa - Sistema de Contas a Receber"
?
? PADC("Tela impressa em "+DTOC(DATE()),80)
FOR PI=4 TO 20
? CHARODD(SCREENSTR(PI,01,78))
NEXT
SET ALTERNATE OFF
SET ALTERNATE TO
COPY FILE("C:TELA.PRN") TO ("LPT1")
ALERT("Tela a ser impressa com sucesso, aguarde a impress„o...")
DELETE FILE("C:TELA.PRN")
RETURN NIL
Veja o que eu fiz:acelconsultoria escreveu:neste tópico
WvW_SetMainCoord( .T. ) // trabalhar sob as mesmas coordenadas da janela principal do programa
WvW_SetMainCoord( .F. ) // cada janela terá sua coordenada independente da janela principal.
Código: Selecionar todos
Restore from tela2
RestScreen(00,00,24,79,VTELA)
inkey(0)Código: Selecionar todos
cls
@ 11,21 SAY "OLA MUNDO"
@ 12,21 SAY "lalas"
@ 13,21 SAY MAXROW()+1
@ 14,21 say MAXCOL()+1
@ 15,21 SAY "---------"
inkey(0)
Vtela:=SaveScreen(00,00,24,79)
Save to Tela2 all like VtelaCódigo: Selecionar todos
FOR PI=4 TO 20 // começa na linha 4 até a linha 20 (isso você pode mudar)
? CHARODD(SCREENSTR(PI,01,78)) // e aqui pega da coluna 1 até a 78
NEXTCódigo: Selecionar todos
*--------------------------------------------------------------*
* RM_MVSAVE()
*--------------------------------------------------------------*
FUNCTION RM_MVSAVE( b, r )
LOCAL i := 0
LOCAL nForLoop := 0
LOCAL cScreen := SAVESCREEN(0, 0, b, r) //
LOCAL nCellSize := INT( len( Savescreen( 0, 0, 0, 0 ) ) * 1 )
LOCAL nStart := 1
LOCAL nRange := INT( ( ( r + 1 ) * nCellSize ) * 1 )
LOCAL cSubString := ''
LOCAL cOutString := ''
For i := 1 To ( b + 1 )
cOutString := ''
cSubString := Substr( cScreen, nStart, nRange )
For nForLoop := 1 To nRange step nCellSize
cOutString += F_Tab_Ascii( Substr( cSubString, nForLoop, 1 ) )
Next
sAux += ( cOutString ) + CHR(13) + CHR(10)
nStart += nRange
Next
RETURN( sAux )
*------------------------------------------*
* CARACTERES DESEJADOS NA TABELA ASCII
*------------------------------------------*
FUNCTION F_Tab_Ascii( cStr )
LOCAL i := 0
LOCAL cAux := ''
FOR i := 33 TO 180 // 33 ... 255
cAux += CHR( i )
NEXT
IF !( cStr $ cAux )
cStr := ' '
ENDIF
RETURN( cStr )
Código: Selecionar todos
? "Max ROW: " + str(maxrow())
? "Max COL: " + str(maxcol())
ScreenFile()
Writes the contents of the current screen to a file.
Syntax
ScreenFile( <cFileName>, ;
[<lAppend>] , ;
[<nOffSet>] , ;
[<lTruncate>] ) --> nBytesWritten
Arguments
<cFileName>
This is a character string holding the name of the file to save a screen to. It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory. If the file does not exist, it is created.
<lAppend>
If .T. (true) is passed, the current screen is appended to <cFileName>. The default value is .F. (false), i.e. the file <cFileName> is overwritten.
<nOffSet>
If <lAppend> is set to .T. (true), this numeric parameter defines the file offset, or starting posiion, where the current screen contents are stored. The default is the end-of-file.
<lTruncate>
When <lTruncate> is set to .T. (true) and the file pointer is not at the end-of-file after writing, the file size is reduced to the current file pointer position. The default value is .F. (false), which leaves the file size unchanged. The parameter is only required when multiple screens are stored in one file. Return
The function writes the contents of the current screen to <cFileName> and returns the number of bytes written as a numeric value
FileScreen()
Reads the contents of a screen from a file.
Syntax
FileScreen( <cFileName>, [<nOffSet>]) --> nBytesRead
Arguments
<cFilename>
This is a character string holding the name of the file to load a screen from, previously saved with ScreenFile(). It must include path and file extension. If the path is omitted from <cFileName>, the file is searched in the current directory.
<nOffSet>
If multiple screens are saved to <cFileName> an offset of (nScreenNumber-1) * nScreenSize bytes must be specified for <nOffSet> to read consecutive screens from the file. The screen size in bytes can be calulated as follows: nScreenSize := 2 * (MaxRow()+1) * (MaxCol()+1)
Return
The function loads a saved screen from <cFileName>, displays it and returns the number of bytes read as a numeric value.