FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Bug in TReport
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Bug in TReport
Posted: Tue Oct 13, 2009 10:01 AM
The following sample

Code (fw): Select all Collapse
#include "Fivewin.ch"
#include "Report.ch"


FUNCTION MAIN()

      REP01( "1" )
      REP01( "2" )

    RETURN NIL


FUNCTION REP01( cNum )

    LOCAL oRpt

    USE TEST

    REPORT oRpt TITLE  "TEST" + cNum PREVIEW

    COLUMN TITLE "St"         DATA Test->State
    COLUMN TITLE "First Name" DATA Test->First
    COLUMN TITLE "   Salary"  DATA Test->Salary

    END REPORT

    oRpt:CellView()

    ACTIVATE REPORT oRpt

    CLOSE TEST

    RETURN NIL


shows only the first preview and then terminate leaving an error.log containing

Error description: Error BASE/1132 Bound error: array access

Stack Calls
===========
Called from: .\source\classes\RPREVIEW.PRG => TPREVIEW:BUILDWINDOW(448)
Called from: .\source\classes\RPREVIEW.PRG => TPREVIEW:NEW(125)
Called from: .\source\classes\RPREVIEW.PRG => RPREVIEW(1462)
Called from: .\source\classes\REPORT.PRG => (b)TREPORT:NEW(180)
Called from: .\source\classes\REPORT.PRG => TREPORT:ACTIVATE(873)
Called from: REP2.prg => REP01(29)
Called from: REP2.prg => MAIN(8)


EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Bug in TReport
Posted: Sun Oct 18, 2009 07:35 PM
Enrico,

It is not exactly a bug. It is the result of a wrong use of FiveWin, I explain why:

FiveWin uses the first created window as the main window of the application, so when the main window ends, then it means that the application ends too. This concept could be discussed, but it is intended mainly to avoid never ending applications.

If you modify your code this way, then it will work fine:
Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "Report.ch"

function Main()

   local oWnd
   
   DEFINE WINDOW oWnd
   
   ACTIVATE WINDOW oWnd ON INIT Reports()
   
return nil   

FUNCTION Reports()

      REP01( "1" )
      REP01( "2" )
      
RETURN NIL

...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Bug in TReport
Posted: Sun Oct 18, 2009 08:36 PM

Great, it works, thank you! :-)

EMG

Continue the discussion