WBrowse + Array = Error

WBrowse + Array = Error

Postby Anderson.OL » Mon Apr 28, 2008 2:20 pm

When update my WBrowse with array generate this error:

Code: Select all  Expand view
   Called from: DlgRecebimento.PRG => (b)SHOWRECEBIMENTO(96)
   Called from: wbrowse.prg => TWBROWSE:SKIP(1583)
   Called from: wbrowse.prg => TWBROWSE:PAINT(703)
   Called from: wbrowse.prg => TWBROWSE:DISPLAY(2038)
   Called from: CONTROL.PRG => TWBROWSE:HANDLEEVENT(0)
   Called from: WINDOW.PRG => _FWH(0)
   Called from:  => SYSREFRESH(0)
   Called from: CONTROL.PRG => TWBROWSE:KEYCHAR(0)
   Called from:  => TWINDOW:HANDLEEVENT(0)
   Called from: CONTROL.PRG => TWBROWSE:HANDLEEVENT(0)
   Called from: WINDOW.PRG => _FWH(0)
   Called from:  => SYSREFRESH(0)
   Called from: DIALOG.PRG => TDIALOG:END(0)


Part of the source code:

Code: Select all  Expand view
(076)   Redefine LISTBOX   oBrw                                  ;
(077)            FIELDS    oRecto:aTitulos[oBrw:nAt]:dEmissao,   ;
(078)                      oRecto:aTitulos[oBrw:nAt]:dVencimento,;
(079)                      oRecto:aTitulos[oBrw:nAt]:cIdTitulo,  ;
(080)                      oRecto:aTitulos[oBrw:nAt]:cRetirado,  ;
(081)                  Str(oRecto:aTitulos[oBrw:nAt]:nValorJuros),;
(082)                  Str(oRecto:aTitulos[oBrw:nAt]:nValorPago) ;
(083)            HEADERS   "Emissão","Vencimento","Título",      ;
(084)                      "Retirado por","Valor","Valor pago"   ;
(085)            Sizes     090,090,090,240,100,100               ;
(086)            ID        301                                   ;
(087)            Font      oFnt                                  ;
(088)            OF        oDlg
(089)
(090)   oBrw:nAt        := 1
(091)   oBrw:bGoTop     := {|| oBrw:nAt := 1 }
(092)   oBrw:bGoBottom  := {|| oBrw:nAt := Eval( oBrw:bLogicLen ) }
(093)   oBrw:bSkip      := {|  nWant, nOld | nOld := oBrw:nAt, oBrw:nAt += nWant,;
(094)                          oBrw:nAt := Max( 1, Min( oBrw:nAt,;
(094)                          Eval( oBrw:bLogicLen ) ) )       ,;
(095)                          oBrw:nAt - nOld }
(096)   oBrw:bLogicLen  := {|| Len( oRecto:aTitulos) } // <<==
(097)   oBrw:aJustify   := {.f.,.f.,.f.,.f.,.t.,.t.}
(098)   oBrw:nClrPane   := {|| ClrPaneBrw() }
(099)   oBrw:blDblClick := {| nRow, nCol | BtnClickMarcar() }


What is this??

Help-me, please :cry:
FiveWin 9.03 + xHarbour !!
User avatar
Anderson.OL
 
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil

Yo lo hago asi, usando TARRAY + WTBROWSE

Postby derpipu » Mon Apr 28, 2008 3:17 pm

Code: Select all  Expand view
#include "tarray.ch"

  oFacturas := nil
  DEFINE STRUCT oFacturas
    STRUCT FIELD cIdArtic  INIT ""
    STRUCT FIELD cArticul  INIT ""
    STRUCT FIELD nCant     INIT 0
    STRUCT FIELD nPrecioU  INIT 0
    STRUCT FIELD nPorcIVA  INIT 0
    STRUCT FIELD nIVA      INIT 0
    STRUCT FIELD nPorcHos  INIT 0
    STRUCT FIELD nHospeda  INIT 0
    STRUCT FIELD nPorcDes  INIT 0
    STRUCT FIELD nDescto   INIT 0
    STRUCT FIELD nImporte  INIT 0
    STRUCT FIELD nRegistro INIT 0
  END STRUCT
  oFacturas:Zap()

        WITH OBJECT oBrowse
          :SetArray( oFacturas:aDatos )

          :cAlias       := "ARRAY"
          :cTooltip     := "Detalle de Conceptos de Facturacion"
          :aHeaders     := { "cantidad", "descripcion", "% descto.", "p. unitario", "importe" }
          :aJustify     := { 1, 0, 1, 1, 1 } // 2 = centrado, 0 = Izquierda, 1 = Derecha

          :aHJustify    := { 2, 2, 2, 2, 2 } // 2 = centrado, 0 = Izquierda, 1 = Derecha
          :aFJustify    := { 1, 0, 1, 1, 1 } // 2 = centrado, 0 = Izquierda, 1 = Derecha

          :aColSizes    := { 80, 270, 80, 80, 100 }

          :aFooters     := { "", "", "", "SubTotal:"  + CRLF +;
                                         "Descuento:" + CRLF +;
                                         "I.V.A.:"    + CRLF +;
                                         "Hospedaje:" + CRLF +;
                                         "Total:",;
                                         transform( nSubTot, "999,999,999.99" ) + CRLF +;
                                         transform( nDescto, "999,999,999.99" ) + CRLF +;
                                         transform( nIVA,    "999,999,999.99" ) + CRLF +;
                                         transform( nHospe,  "999,999,999.99" ) + CRLF +;
                                         transform( nTotal,  "999,999,999.99" ) }

          :bLine        := { || { transform( oFacturas:nCant,    "99,999,999.99" ),;
                                  oFacturas:cIdArtic + CRLF + oFacturas:cArticul ,;
                                  transform( oFacturas:nDescto,  "999%" ),;
                                  transform( oFacturas:nPrecioU, "99,999,999.99" ),;
                                  transform( oFacturas:nImporte, "99,999,999.99" ) } }

          :bLogicLen    := { || Len( oFacturas:aDatos ) }
          :bTextColor   := { | nRow,nCol,nStyleLine | iif( ( (nStyleLine=1 .or. nStyleLine = 2) ), nClrTxtHeader, ) }
          :bBkColor     := { | nRow,nCol,nStyleLine | iif( ( (nStyleLine=1 .or. nStyleLine = 2) ), nClrBkHeader, ) }
          :bSkip        := { | nSkip | oFacturas:skip(nSkip)}

          // Datas que son estandares en los modulos
          :bFont         := { | nRow, nCol, nStyleLine | SeleccionaFuente( nRow, nCol, nStyleLine, oApp:fNormal, oApp:fBold, oApp:fBold, oApp:fBold ) }
          :nHeaderHeight := 30
          :nFooterHeight := 70
          :nHeaderStyle  := 3
          :nFooterStyle  := 3
          :nLineHeight   := 30
          :nClrPane      := { || iif( oFacturas:Recno() % 2 == 0, nRGB( 193, 221, 255 ), nRGB( 221, 245, 255 ) ) }
          :nClrForeFocus := { || CLR_WHITE }
          *:nFreeze       := 5

          :lCellStyle    := .F.
          :lAdjLastCol   := .T.
          :lOnlyBorder   := .T.
          :lAdjBrowse    := .T.
          :lDrawFooters  := .T.
        END WITH
Luis Fernando Rubio Rubio
derpipu
 
Posts: 94
Joined: Tue Mar 28, 2006 4:09 pm
Location: Tequila, Jalisco Mexico

Postby Anderson.OL » Mon Apr 28, 2008 7:37 pm

how work method skip this class?
FiveWin 9.03 + xHarbour !!
User avatar
Anderson.OL
 
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil

Postby Antonio Linares » Mon Apr 28, 2008 8:38 pm

Anderson,

Are you using oBrw:SetArray( aNewArray ) ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Anderson.OL » Mon Apr 28, 2008 8:49 pm

Yes... I tried this:

Code: Select all  Expand view
   Redefine LISTBOX   oBrw                                  ;
            FIELDS    oRecto:aTitulos[oBrw:nAt]:dEmissao,   ;
                      oRecto:aTitulos[oBrw:nAt]:dVencimento,;
                      oRecto:aTitulos[oBrw:nAt]:cIdTitulo,  ;
                      oRecto:aTitulos[oBrw:nAt]:cRetirado,  ;
                  Str(oRecto:aTitulos[oBrw:nAt]:nValorJuros),;
                  Str(oRecto:aTitulos[oBrw:nAt]:nValorPago) ;
            HEADERS   "Emissão","Vencimento","Título",      ;
                      "Retirado por","Valor","Valor pago"   ;
            Sizes     090,090,090,240,100,100               ;
            ID        301                                   ;
            Font      oFnt                                  ;
            OF        oDlg
           
   oBrw:SetArray(oRecto:aTitulos)
FiveWin 9.03 + xHarbour !!
User avatar
Anderson.OL
 
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil

Postby Antonio Linares » Tue Apr 29, 2008 12:26 am

What error do you get ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Anderson.OL » Tue Apr 29, 2008 11:27 am

this
Code: Select all  Expand view
Application
===========
   Path and name: F:\Anderson\RCA Trade\Terminal.EXE (32 bits)
   Size: 5,016,064 bytes
   Time from start: 0 hours 1 mins 19 secs
   Error occurred at: 29/04/2008, 08:24:56
   Error description: Error BASE/1132  Erro de limite: acesso de array
   Args:
     [   1] = A   { ... }
     [   2] = N   2

Stack Calls
===========
   Called from: DlgRecebimento.PRG => (b)SHOWRECEBIMENTO(88)
   Called from: wbrowse.prg => TWBROWSE:DRAWSELECT(414)
   Called from: wbrowse.prg => (b)TWBROWSE:TWBROWSE(162)
   Called from:  => TWBROWSE:LOSTFOCUS(0)
   Called from: CONTROL.PRG => TWBROWSE:KILLFOCUS(0)
   Called from: CONTROL.PRG => TWBROWSE:HANDLEEVENT(0)
   Called from: WINDOW.PRG => _FWH(0)
   Called from:  => SETFOCUS(0)
   Called from: CONTROL.PRG => TGET:SETFOCUS(0)
   Called from: DlgRecebimento.PRG => BTNCLICKVOLTAR(1041)
   Called from: DlgRecebimento.PRG => BTNCLICKRECEBER(1363)
   Called from: DlgRecebimento.PRG => KEYDOWNDLG(438)
   Called from: DlgRecebimento.PRG => (b)SHOWRECEBIMENTO(36)
   Called from: WINDOW.PRG => TWINDOW:KEYDOWN(0)
   Called from: DIALOG.PRG => TDIALOG:KEYDOWN(0)
   Called from: WINDOW.PRG => TWINDOW:KEYDOWN(0)
   Called from: CONTROL.PRG => TCONTROL:KEYDOWN(0)
   Called from: wbrowse.prg => TWBROWSE:KEYDOWN(1311)
   Called from:  => TWINDOW:HANDLEEVENT(0)
   Called from: CONTROL.PRG => TWBROWSE:HANDLEEVENT(0)
   Called from: WINDOW.PRG => _FWH(0)
   Called from:  => DIALOGBOX(0)
   Called from: DIALOG.PRG => TDIALOG:ACTIVATE(0)
   Called from: DlgRecebimento.PRG => SHOWRECEBIMENTO(219)
   Called from: Terminal.PRG => (b)CREATEMENU(172)
   Called from: MENU.PRG => TMENU:COMMAND(0)
   Called from: WINDOW.PRG => TWINDOW:COMMAND(0)
   Called from:  => TWINDOW:HANDLEEVENT(0)
   Called from: WINDOW.PRG => _FWH(0)
   Called from:  => WINRUN(0)
   Called from: WINDOW.PRG => TWINDOW:ACTIVATE(0)
   Called from: Terminal.PRG => MAIN(103)
FiveWin 9.03 + xHarbour !!
User avatar
Anderson.OL
 
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil

Postby Antonio Linares » Tue Apr 29, 2008 1:56 pm

This is a sample that shows an array from a browse:
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

   local oDlg, oBrw, aValues := { { "One", "Two", "Three" }, { "Four", "Five", "Six" } }
   
   DEFINE DIALOG oDlg TITLE "Test"
   
   @ 0, 0 LISTBOX oBrw ;
      FIELDS aValues[ oBrw:nAt, 1 ], aValues[ oBrw:nAt, 2 ], aValues[ oBrw:nAt, 3 ] ;
      OF oDlg
   
   oBrw:SetArray( aValues )
   oDlg:oClient = oBrw
   
   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT oDlg:ReSize()
   
return nil   
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Anderson.OL » Tue Apr 29, 2008 2:00 pm

Code: Select all  Expand view
oDlg:oClient = oBrw


that is necessary?
FiveWin 9.03 + xHarbour !!
User avatar
Anderson.OL
 
Posts: 92
Joined: Thu Feb 15, 2007 11:37 am
Location: Itaocara - RJ - Brasil

Postby Antonio Linares » Tue Apr 29, 2008 6:15 pm

No, that is used to resize the control to the entire area of its container
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests

cron