Page 1 of 1

txtfile

PostPosted: Mon Oct 12, 2015 7:36 pm
by Silvio.Falconi
some have a sample with txtfile ?
i wish write a message... live it's possible ?

Re: txtfile

PostPosted: Mon Oct 12, 2015 8:38 pm
by cnavarro
Look

..\samples\redefine.prg
..\samples\srcview.prg
..\samples\testfile.prg

Re: txtfile

PostPosted: Tue Oct 13, 2015 7:09 am
by driessen
Why not using :

FCreate()
FWrite()
FClose()

Re: txtfile

PostPosted: Tue Oct 13, 2015 10:25 am
by Silvio.Falconi
Driessen,cnavarro,
I have this problem I create txtfile and show each lines into xbrowse on a dialog . On anothe function I use the function scrivitrace() to add text on txtfile class
when I refresh the xbrowse it make error


Local oBrwTesto
Local oText:=TTxtFile():New( "TimeTrace.txt" )

.....

DEFINE DIALOG oDlgCicloMater


// box trace
cTitle:= "Ciclo operazioni"
@ 100, 05 XBROWSE oBrwTesto OF oDlgCicloMater ;
SIZE 220,80 PIXEL ;
COLUMNS "cLine";
OBJECT oText;
FOOTERS NOBORDER
WITH OBJECT oBrwTesto:cLine
:bFooter:= {|| "Linea = " + LTrim( Str( oText:RecNo() ) ) + " / " + LTrim( Str( oText:RecCount() ) )}
:cHeader:= cTitle
END

WITH OBJECT oBrwTesto
:nfreeze := 1
:nMarqueeStyle:= 7
:nStretchCol := 1
:nRowHeight := 20
:lRecordSelector := .f.
:lHScroll:=.f.
END
oBrwTesto:CreateFromCode()

oDlgCicloMater:bStart := { || SysRefresh(), start(oDlgCicloMater,nGiri,oBrwTesto,oText) }
ACTIVATE DIALOG oDlgCicloMater center
return nil

on start function i use

Scrivitrace(oText,"bla bla bla ",oBrwTesto)
....


return nil



Function Scrivitrace(oText,ctesto,oBrwTesto)
if oText:Open()
oText:Add( ctesto )
oText:Close()
endif

oBrwTesto:refresh() <------------------------error
return nil



how I can resolve it ?