home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 16 / CD_ASCQ_16_0994.iso / news / 4611 / fw16d.ins / SAMPLES / FWREPORT.PRG < prev    next >
Text File  |  1994-05-13  |  4KB  |  125 lines

  1. #include "FiveWin.ch"
  2. #include "FwReport.ch"
  3.  
  4. static oWnd
  5. static nX := 0, nY := 0
  6. static lEditing := .f.
  7.  
  8. //----------------------------------------------------------------------------//
  9.  
  10. function Main()
  11.  
  12.    local oBar
  13.  
  14.    USE Report
  15.  
  16.    SET 3DLOOK ON
  17.  
  18.    DEFINE WINDOW oWnd FROM 1, 1 TO 20, 70 TITLE "Testing Styles" ;
  19.       MDI VSCROLL HSCROLL
  20.  
  21.    DEFINE BUTTONBAR oBar OF oWnd
  22.  
  23.    DEFINE BUTTON FILE "..\bitmaps\Info.bmp" OF oBar ;
  24.       MESSAGE "Edit Report Info" ACTION MsgInfo( "FiveWin Reports Engine 1.0" )
  25.  
  26.    DEFINE BUTTON FILE "..\bitmaps\OpenPrj.bmp" OF oBar ;
  27.       MESSAGE "Select a previous project"
  28.  
  29.    DEFINE BUTTON FILE "..\bitmaps\Exit.bmp" OF oBar ;
  30.       MESSAGE "Exit FiveWin Reports" ACTION oWnd:End()
  31.  
  32.    DEFINE BUTTON FILE "..\bitmaps\Browse.bmp" GROUP OF oBar ;
  33.       MESSAGE "Edit Report Info" ACTION Browse( "Report Data", "&Elements" )
  34.  
  35.    DEFINE BUTTON FILE "..\bitmaps\Printer.bmp" OF oBar ;
  36.       MESSAGE "Send report to the printer"
  37.  
  38.    DEFINE BUTTON FILE "..\bitmaps\BtnBmp.bmp" GROUP OF oBar ;
  39.       MESSAGE "Place a Bitmap"
  40.  
  41.    DEFINE BUTTON FILE "..\bitmaps\Text.bmp" OF oBar ;
  42.       MESSAGE "Place some Text" ACTION TextNew()
  43.  
  44.    DEFINE BUTTON FILE "..\bitmaps\Box.bmp" OF oBar ;
  45.       MESSAGE "Place a Box"
  46.  
  47.    SET MESSAGE OF oWnd TO "Working on reports"
  48.  
  49.    ACTIVATE WINDOW oWnd ;
  50.       ON PAINT ReportDisplay() ;
  51.       ON UP   ( nX += 10, oWnd:oWndClient:Refresh() ) ;
  52.       ON DOWN ( nX -= 10, oWnd:oWndClient:Refresh() ) ;
  53.       ON PAGERIGHT MsgInfo( "Page Right" )
  54. return nil
  55.  
  56. //----------------------------------------------------------------------------//
  57.  
  58. function ReportDisplay()
  59.  
  60.    if ! lEditing
  61.       GO TOP
  62.  
  63.       while ! EoF()
  64.          do case
  65.             case AllTrim( Report->Type ) == "SAY"
  66.                  oWnd:oWndClient:Say( nX + Report->Row, nY + Report->Col,;
  67.                            AllTrim( Report->Data ),,,, .t. )
  68.  
  69.             case AllTrim( Report->Type ) == "BITMAP"
  70.                if File( Report->Data )
  71.                   oWnd:oWndClient:SayBitmap( nX + Report->Row,;
  72.                                              nY + Report->Col, Report->Data )
  73.                endif
  74.  
  75.             case AllTrim( Report->Type ) == "BOX"
  76.                  oWnd:oWndClient:Box( nX + Report->Row, nY + Report->Col,;
  77.                                       nX + Report->Row + Report->Height - 1,;
  78.                                       nY + Report->Col + Report->Width - 1 )
  79.          endcase
  80.          SKIP
  81.       end
  82.  
  83.       GO TOP
  84.    endif
  85.  
  86. return nil
  87.  
  88. //----------------------------------------------------------------------------//
  89.  
  90. function TextNew()
  91.  
  92.    local oDlg
  93.    local nRow  := 0
  94.    local nCol  := 0
  95.    local cText := PadR( "Some Text", 50 )
  96.    local lSave := .f.
  97.  
  98.    DEFINE DIALOG oDlg RESOURCE "Text"
  99.  
  100.    REDEFINE GET nRow PICTURE "999" ID ID_ROW OF oDlg
  101.  
  102.    REDEFINE GET nCol PICTURE "999" ID ID_COL OF oDlg
  103.  
  104.    REDEFINE GET cText ID ID_TEXT OF oDlg
  105.  
  106.    REDEFINE BUTTON ID ID_ACEPTAR  OF oDlg ACTION ( lSave := .t., oDlg:End() )
  107.    REDEFINE BUTTON ID ID_CANCELAR OF oDlg ACTION oDlg:End()
  108.  
  109.    ACTIVATE DIALOG oDlg CENTERED
  110.  
  111.    if lSave
  112.       lEditing = .t.
  113.       APPEND BLANK
  114.       Report->Row  := nRow
  115.       Report->Col  := nCol
  116.       Report->Type := "SAY"
  117.       Report->Data := AllTrim( cText )
  118.       lEditing = .f.
  119.       oWnd:Refresh()
  120.    endif
  121.  
  122. return nil
  123.  
  124. //----------------------------------------------------------------------------//
  125.