Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating a Status Form
Message
From
15/10/2003 10:34:58
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00838805
Message ID:
00838876
Views:
20
>I have an application which prints out a set of reports based on a key in a cursor. When it is printing each report I would like some form of status form which when printing each report it will record the key from the cursor that it is printing. I can use the wait window but that will change everytime it prints. I want a scrolling list so everytime it prints the report it adds it to the list in the status window with the dat and time it printed.
>
>Is this possible?
>
>Many Thanks

Here's the Class Browser generated code for the status output form and caller program I use.
I use an scx in development, it's just easier to send along code.

e.g., for the ID and DateTime in a loop
** 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)
EndIf
In the right-click of the editbox, I call a context menu which in return calls the ClearStats() and SaveOutput() of the form.
Insanity: Doing the same thing over and over and expecting different results.
Previous
Reply
Map
View

Click here to load this message in the networking platform