Bug in TReport

Bug in TReport

Postby Enrico Maria Giordano » Tue Oct 13, 2009 10:01 am

The following sample

Code: Select all  Expand view
#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
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Re: Bug in TReport

Postby Antonio Linares » Sun Oct 18, 2009 7: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: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Bug in TReport

Postby Enrico Maria Giordano » Sun Oct 18, 2009 8:36 pm

Great, it works, thank you! :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 85 guests