** start loop statout(Transform(id)+" "+TToC(DateTime())) ** end loop
************************************************** *-- Form: frmstatout (c:\walpole\tools\statout.scx) *-- ParentClass: _form (c:\program files\microsoft visual foxpro 8\ffc\_base.vcx) *-- BaseClass: form *-- Time Stamp: 10/15/03 09:15:07 AM * DEFINE CLASS frmstatout AS _form Top = 0 Left = 0 Height = 248 Width = 375 DoCreate = .T. BorderStyle = 3 Caption = "Status Output" HalfHeightCaption = .T. Name = "frmstatout" ADD OBJECT edtoutput AS editbox WITH ; FontName = "courier new", ; Height = 248, ; Left = 0, ; Top = 0, ; Width = 375, ; IntegralHeight = .T., ; Name = "edtOutput" PROCEDURE showstat LParameters tuValue, tlHeader, tlSameLine Local lcVal, lcAdd, lnCol, lnRow Store "" To lcVal, lcAdd Store 0 To lnCol, lnRow *-- get the current displayed value lcVal=This.edtOutput.Value If Len(lcVal)>0 And Right(lcVal,1)=Chr(13) And tlSameLine lcVal=Left(lcVal,Len(lcVal)-1) EndIf If Type("Alen(tuValue)")=="N" *-- it's an array tlHeader=.F. lnCol=ALen(tuValue,2) lnRow=ALen(tuValue,1) For ji = 1 To lnRow lcRow="("+Transform(ji) If lnCol>0 For jj = 1 To lnCol lcCol=lcRow+","+Transform(jj)+") " lcAdd = lcAdd + lcCol + Transform(tuValue[ji,jj]) + Chr(13) Next Else lcAdd = lcAdd + lcRow + ") "+Transform(tuValue[ji])+Chr(13) EndIf Next Else *-- just transform the value that came in lcAdd = Transform(tuValue) EndIf If tlHeader *-- add header separator lcHead="*"+Replicate("-",Len(lcAdd)) lcAdd=lcHead+Chr(13)+lcAdd+Chr(13)+lcHead EndIf *-- add the new line lcVal = lcVal + lcAdd + Chr(13) This.edtOutput.Value=lcVal *-- scroll the editbox This.edtOutput.SelStart=Len(lcVal) This.edtOutput.Refresh() ENDPROC PROCEDURE clearstats this.edtOutput.Value="" ENDPROC PROCEDURE saveoutput StrToFile(this.edtOutput.Value,PutFile(),0) ENDPROC PROCEDURE Resize this.edtOutput.Width=this.Width this.edtOutput.Height=this.Height ENDPROC PROCEDURE Init this.Top=0 this.Left=_screen.Width-this.Width ENDPROC PROCEDURE edtoutput.RightClick DO statout_menu.mpr with thisform ENDPROC ENDDEFINE * *-- EndDefine: frmstatout **************************************************I use a caller program/method in dev/prod, pointing to global var/app.property, instead of instantiating everytime. This is the dev version
** statout.prg LParameters tuValue, tlClearFirst, tlHeader, tlSameLine If VarType(goStatout)#"O" Public goStatout Do Form statout Name goStatout EndIf If tlClearFirst goStatout.clearstats() EndIf If Type("Alen(tuValue)")="N" goStatout.showstat(@tuValue, tlHeader, tlSameLine) Else goStatout.showstat(tuValue, tlHeader, tlSameLine) EndIfIn the right-click of the editbox, I call a context menu which in return calls the ClearStats() and SaveOutput() of the form.