FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour De nuevo con TxBrowse nuevo error SelectAll
Posts: 464
Joined: Tue Mar 21, 2006 07:30 PM
De nuevo con TxBrowse nuevo error SelectAll
Posted: Sat Mar 02, 2013 10:57 AM
Hola a todos
Pues nada de nuevo a la carga con TxBrowse, esta vez con el error Error BASE/1004 Class: 'NIL' has no exported method: SELECTALL
Este error se produce en el oBrw:bPastEof(), cuando intento añadir un registro y el anterior está vacío, también se produce si el registro anterior está "borrado".
Me explico.
El Browse es un array, tiene un registro, y yo le añado otro registro pero no escribo nada en él. Si intento añadir otro registro se produce el error.
Ahora bien, supongamos que tenemos dos registros y "borro" el último, (pongo lo de borro entre comillas porque este módulo es el que me sirve para modificar las ventas y como necesito retener el registro para calcular los totales de la cabecera, lo que hago es marcarlo como borrado y no dejar que se hagan cambios una vez borrado)
pues bien, como decía antes, si intento añadir un nuevo registro, sucede el error mencionado.
Este es el Borwse :
Code (fw): Select all Collapse
   oBrw = TXBrowse():New( oDlgAlb ) 
   oBrw:SetArray(aLinVentas,.T.,0,.F.)  
       
   oBrw:nColDividerStyle    := LINESTYLE_BLACK
   oBrw:nRowDividerStyle    := LINESTYLE_BLACK
   oBrw:lRecordSelector     := .t.
   oBrw:nHeaderLines        := 1
   oBrw:nDataLines          := 1
     oBrw:nRowSel             := 1
     oBrw:nMarqueeStyle       := 3 //Highlight row //MARQSTYLE_HIGHLCELL
   oBrw:bClrStd := {|| If (aLinVentas[oBrw:nArrayAt,14],{nRGB(255,255,255),nRGB(255,0,0)},{ nRGB( 0, 0, 0), nRGB(255,248,220) }) } // colores para lineas normales 
   oBrw:bClrSel := {|| If (aLinVentas[oBrw:nArrayAt,14],{nRGB(255,255,255),nRGB(255,0,0)},{ nRGB(0,0,0), nRGB(241,222,088) }) } // para barra de linea selecc cuando el control no tiene el foco 
   oBrw:bClrSelFocus := {|| If (aLinVentas[oBrw:nArrayAt,14],{nRGB(255,255,255),nRGB(255,0,0)},{ nRGB( 0, 0, 0), nRGB(248,195, 34)}) } // para barra de linea selecc cuando el control tiene el foco 


   oBrw:lFastEdit  := .T.
   oBrw:bPastEof = {||  InsertRowM(oBrw) ,oBrw:GoLeftMost(),oBrw:Refresh(),;     //<----------------Aquí es donde se produce el error
                                                oBrw:aCols[ 1 ]:Edit() } 
                                               //agrega registro y "oprime" enter
                        
     
   oCol = oBrw:AddCol()
*   oCol:bStrData      := { || aLinVentas[oBrw:nArrayAt,1] }
   oCol:bEditValue    := { || aLinVentas[oBrw:nArrayAt,1] }   
   oCol:bEditWhen     := { || aLinVentas[oBrw:nArrayAt,14] = .F. }
   oCol:nEditType     := EDIT_GET
   oCol:cHEADER       := "ARTICULO" 
   oCol:nWidth        := 100
   oCol:bOnPostEdit   := { | oCol, xVal, nKey | If( Empty(aLinVentas),( InsertRowM(oBrw), oBrw:Refresh() ),) ,; 
   If( nKey == VK_RETURN, If(BArticulo(oBrw,xVal,"CODIGO"),(aLinVentas[oBrw:nArrayAt,9] := ImporteM(oBrw,1),;
                           InsertRowM(oBrw),oBrw:Refresh() ),),),;
   If( nKey == VK_ESCAPE .and. Empty(aLinVentas[oBrw:nArrayAt,1]), (DeleteRowM(oBrw),;
                                    oBrw:Refresh() ), ) }
                               
   oCol:nArrayCol := 1
*-------------------------------------------------------------------------------          
     oCol = oBrw:AddCol()
*   oCol:bStrData      := { || aLinVentas[oBrw:nArrayAt,2] }
   oCol:bEditValue    := { || aLinVentas[oBrw:nArrayAt,2] } 
   oCol:bEditWhen     := { || aLinVentas[oBrw:nArrayAt,14] = .F. }     
   oCol:nEditType     := EDIT_GET
   oCol:cHEADER       := "DESCRIPCIÓN" 
   oCol:nWidth        := 350   
   oCol:bOnPostEdit = { | oCol, xVal, nKey | If( Empty(aLinVentas), (InsertRowM(),oBrw:Refresh() ),),;
     If( nKey == VK_RETURN, aLinVentas[oBrw:nArrayAt,2] := xVal ,) } 
   oCol:nArrayCol := 2     
*-------------------------------------------------------------------------------                  
     oCol = oBrw:AddCol()
*   oCol:bStrData      := { ||Transform( aLinVentas[oBrw:nArrayAt,3],"999,999.99" ) }    
   oCol:bEditValue    := { || Transform(aLinVentas[oBrw:nArrayAt,3],"999,999.99") }
   oCol:bEditWhen     := { || aLinVentas[oBrw:nArrayAt,14] = .F. }   
   oCol:nDataStrAlign := 1 //alineado a la derecha 
   oCol:nEditType     := EDIT_GET
   oCol:cHEADER       := "CANTIDAD" 
   oCol:nWidth        := 80   
   oCol:bOnPostEdit = { | oCol, xVal, nKey | If( Empty(aLinVentas), (InsertRowM(),oBrw:Refresh() ),),;
     If( nKey == VK_RETURN, ( aLinVentas[oBrw:nArrayAt,3] := Val(xVal),;
   If ( Val(xVal) <> 0, (aLinVentas[oBrw:nArrayAt,9] := ImporteM(oBrw,2) ),)) ,) }
   oCol:nArrayCol := 3            
*-------------------------------------------------------------------------------   
   oCol = oBrw:AddCol()
*   oCol:bStrData      := { ||Transform( aLinVentas[oBrw:nArrayAt,4],"99,999.99999") } 
   oCol:bEditValue    := { || Transform(aLinVentas[oBrw:nArrayAt,4],"99,999.99999") } 
   oCol:bEditWhen     := { || aLinVentas[oBrw:nArrayAt,14] = .F. }       
   oCol:nDataStrAlign := 1 //alineado a la derecha 
   oCol:nEditType     := EDIT_GET
   oCol:cHEADER       := "PRECIO" 
   oCol:nWidth        := 80   
   oCol:bOnPostEdit = { | oCol, xVal, nKey | If( Empty(aLinVentas), (InsertRowM(),oBrw:Refresh() ),),;
     If( nKey == VK_RETURN, (aLinVentas[oBrw:nArrayAt,4] := Val(xVal) ,;
   If ( Val(xVal) <> 0, aLinVentas[oBrw:nArrayAt,9] := ImporteM(oBrw,3),)) ,) }
   oCol:nArrayCol := 4
*-------------------------------------------------------------------------------
   oCol = oBrw:AddCol()
*   oCol:bStrData      := { ||Transform( aLinVentas[oBrw:nArrayAt,5],"99") }   
   oCol:bEditValue    := { || Transform(aLinVentas[oBrw:nArrayAt,5],"99") } 
   oCol:bEditWhen     := { || aLinVentas[oBrw:nArrayAt,14] = .F. }     
   oCol:nDataStrAlign := 1 //alineado a la derecha 
   oCol:nEditType     := EDIT_GET
   oCol:nWidth        := 40   
   oCol:cHEADER       := "IVA %" 
   oCol:bOnPostEdit = { | oCol, xVal, nKey | If( Empty(aLinVentas), (InsertRowM(),oBrw:Refresh() ),),;
     If( nKey == VK_RETURN, (aLinVentas[oBrw:nArrayAt,5] := Val(xVal) ,;
   If ( Val(xVal) <> 0, (aLinVentas[oBrw:nArrayAt,9] := ImporteM(oBrw,4),InsertRowM(oBrw)) ,)),) }
   oCol:nArrayCol := 5
*-------------------------------------------------------------------------------
   oCol = oBrw:AddCol()
*   oCol:bStrData     := { ||aLinVentas[oBrw:nArrayAt,14] }   
   oCol:bEditValue   := { ||aLinVentas[oBrw:nArrayAt,14] }   
   oCol:SetCheck( Nil,.F.,{"Si","No",""} )  
   oCol:nEditType     := EDIT_GET
   oCol:cHEADER       := "BORRAR" 
   oCol:nWidth        := 80   
   oCol:bOnPostEdit = { | oCol, xVal, nKey | aLinVentas[oBrw:nArrayAt,14] := xVal}
   oCol:nArrayCol := 6

*-------------------------------------------------------------------------------   
   oBrw:bKeyDown :={ | nKey | TeclasM(nKey, oBrw ) }
   oBrw:aCols[2]:bLClickHeader :=  {|| BNomArti(oBrw,"NOMBRE",oCol),InsertRowM(oBrw) }
   oBrw:CreateFromResource(2001)


¿Qué estoy haciendo mal para que suceda este error?
Necesitaría una manita urgente para solucionar este problema
Un saludo
Pedro
gahetesoft@gmail.com
FWH12.06 BCC582, Xverce CW, Pelles C 6.00.4,PSPAD 4.54
y ahora con ADO

Continue the discussion