Antonio este el codigo del llamado al xbrowse
REDEFINE XBROWSE ::oLbxBody ID 600 OF oDlg ;
FIELDS Str( oList:Pos,3) ,;
oList:Current[1] ,;
oList:Current[2] ,;
Transform(oList:Current[3],"@Z 9999,999.99") ,;
Transform(oList:Current[4],"@Z 9999,999,999.99") ,;
Transform(oList:Current[5],"@Z 999.99") ,;
Transform(oList:Current[6],"@Z 999.99") ,;
TransForm(Round((oList:Current[3]*oList:Current[4]),0),"@Z 9999,999,999");
HEADERS "No","Código","Descripción del Producto","Cantidad","Vlr.Unitario" ,;
"% Desc","% Iva","Subtotal" ;
ON DBLCLICK IF(!Empty(::oMacot:CodCli) .And. !lView ,;
(::NewIte(oList,.F.),::oLbxBody:Refresh()),) ;
ON CHANGE Eval(bChanBrw) ;
JUSTIFY 1,0,0,1,1,1,1,1 ;
COLSIZES 27,90,140,70,90,40,40,90
XbrStyles(::oLbxBody ) // Confugurando el Estilo del Xbrowse
::oLbxBody:nHeaderLines := 1
::oLbxBody:bKeyDown := {|nKey,nFlags|::LeeTecla(nKey,nFlags,oList,lView),Eval(bChanBrw)}
oList:SetBrowse(::oLbxBody)
Siempre me muestra el primer elemento.
Adjunto la clase Tlist que estoy usando.
/---------------------------------------------------------
//----------------------------------------------------------------------------//
// AUTOR.....: Manuel Exp¢sito Su rez Soft 4U '1994-2001 //
// e-Mail....:
maex14@dipusevilla.es //
// CLASE.....: TList //
// FECHA MOD.: 09/04/2001 //
// VERSION...: 1.00 //
// PROPOSITO.: Gesti¢n de arrays //
//----------------------------------------------------------------------------//
#include "FiveWin.ch"
CLASS TList
DATA aList AS ARRAY
DATA Pos, Size AS NUMERIC
DATA EOA, BOA AS LOGICAL
DATA aDelete AS ARRAY // Jose David , Pista de los Borrados
METHOD New( xLen ) CONSTRUCTOR
/* Mantenimiento */
METHOD Add( Val )
METHOD Insert( Val )
METHOD Update( Val ) INLINE ::aList[ ::Pos ] := Val
MESSAGE Delete() METHOD _Delete()
/* Movimiento */
METHOD GoTo( n )
METHOD GoTop() INLINE ::GoTo( 1 )
METHOD GoBottom() INLINE ::GoTo( ::Size )
METHOD First() INLINE ::GoTo( 1 )
METHOD Last() INLINE ::GoTo( ::Size )
METHOD Prior() INLINE ::Skip( -1 )
METHOD Next() INLINE ::Skip( 1 )
METHOD Skip( n )
/* Varios */
METHOD Current() INLINE ::aList[ ::Pos ]
METHOD Eval( bBlock ) INLINE AEval( ::aList, bBlock )
METHOD Sort( bSort ) INLINE ASort( ::aList,, bSort )
METHOD Scan( uVal, nInit )
/* Browse */
METHOD SetBrowse( oBrw )
METHOD Skipper( n )
/* Jose */
//METHOD ValDefault()
METHOD ReadRow()
METHOD SaveRow(Val)
METHOD BlankRow()
ENDCLASS
//---------------------------------------------------------------------------//
METHOD New( xElem ) CLASS TList
local cType := ValType( xElem )
if cType == "N"
::aList := Array( xElem )
elseif cType == "A"
::aList := xElem
else
::aList := {}
endif
::aDelete := {}
::Size := len( ::aList )
::Pos := if( ::Size > 0, 1, 0 )
::EOA := ::BOA := ( ::Size == 0 )
return( Self )
//---------------------------------------------------------------------------//
METHOD _Delete() CLASS TList
Local aRec:=::ReadRow()
Local nLen
IF Len(::aList) > 0
//Pista de Los Borrados
nLen:=Len(::aList[::Pos])
IF ::aList[::Pos,nLen] > 0
AADD(::aDelete,::aList[::Pos,nLen]) // Solo Grabo el Numero del Registro, y si es > 0
Endif
ADel(::aList, ::Pos )
ASize(::aList, --::Size )
Else
Tone(500,1)
Endif
return( Self )
//---------------------------------------------------------------------------//
METHOD Insert( Val ) CLASS TList
Local aDef:=::BlankRow()
::EOA := ::BOA := .f.
AAdd( ::aList, nil )
AIns( ::aList, ::Pos )
if !empty( Val )
::aList[ ::Pos ] := Val
else
::aList[ ::Pos ] := aDef
Endif
++::Size
return( Self )
//---------------------------------------------------------------------------//
METHOD Add( Val ) CLASS TList
::EOA := ::BOA := .f.
if !empty( Val )
aAdd( ::aList, Val )
Else
aAdd( ::aList, ::BlankRow())
Endif
::Pos := ++::Size
return( Self )
//---------------------------------------------------------------------------//
METHOD GoTo( n ) CLASS TList
local nRec := ::Pos
::EOA := ::BOA := .f.
if ValType( n ) == "N" .and. n > 0
::Pos := if( n > ::Size, ( ::EOA := .t., ::Size ), n )
endif
return( Self )
//---------------------------------------------------------------------------//
METHOD Skip( n ) CLASS TList
Local nPos := 0
DEFAULT n:= 1
if ValType( n ) = "N"
nPos := ::Pos + n
if nPos > ::Size
::GoBottom()
::EOA := .t.
elseif nPos < 1
::GoTop()
::BOA := .t.
else
::GoTo( nPos )
endif
endif
return( Self )
//---------------------------------------------------------------------------//
METHOD Skipper( nSkip ) CLASS TList
local nSkipped := 0
nSkipped := Min( Max( nSkip, 1 - ::Pos ), ::Size - ::Pos )
::GoTo( ::Pos + nSkipped )
return( nSkipped )
//---------------------------------------------------------------------------//
METHOD SetBrowse( oBrw ) CLASS TList
if upper( oBrw:ClassName() ) $ "TWBROWSE TCBROWSE TGRID" // De WINDOWS
oBrw:bGoTop := { || ::GoTop() }
oBrw:bGoBottom := { || ::GoBottom() }
oBrw:bSkip := { | n | ::Skipper( n ) }
oBrw:bLogicLen := { || ::Size }
oBrw:cAlias := "ARRAY"
elseif upper( oBrw:ClassName() ) $ "TBROWSE TDBBRW" // Del DOS
oBrw:goTopBlock := { || ::GoTop() }
oBrw:goBottomBlock := { || ::GoBottom() }
oBrw:SkipBlock := { | n | ::Skipper( n ) }
endif
if upper( oBrw:ClassName() ) $ "XBROWSE" // De WINDOWS
oBrw:bGoTop := { || ::GoTop() }
oBrw:bGoBottom := { || ::GoBottom() }
oBrw:bSkip := { |n| ::Skipper( n ) }
//oBrw:bLogicLen := { || ::Size }
oBrw:bKeyCount := { || Len( ::aList ) }
oBrw:cAlias := "ARRAY"
Endif
//::ValDefault()
return( oBrw )
//---------------------------------------------------------------------------//
METHOD Scan( uVal, nInit ) CLASS TList
local nPos := aScan( ::aList, uVal, nInit )
::Pos := if( nPos == 0, ::Pos, nPos )
return( nPos )
//---------------------------------------------------------------------------//
/*
METHOD ValDefault() CLASS TList
Local aStru:={}, x
FOR X:=1 To LEN(::aList[1])
if valtype(::aList[1,x])=="N"
aadd(aStru,0)
elseif valtype(::aList[1,x])=="C"
aadd(aStru,space(len(::aList[1,x])))
elseif valtype(::aList[1,x])=="L"
aadd(aStru,.f.)
elseif valtype(::aList[1,x])=="D"
aadd(aStru,CTOD(""))
else
aadd(aStru,NIL)
endif
next
::aDefault :=aStru
Return(Self)
*/
//---------------------------------------------------------------------------//
METHOD ReadRow() CLASS TList
Local nColumns
Local aDatos
nColumns := If( ! Empty( ::aList ), Len( ::aList[1] ), 0 )
aDatos:=Array(nColumns)
For nI := 1 To nColumns
aDatos[ni]:=::aList[::Pos,nI]
Next
Return (aDatos)
//---------------------------------------------------------------------------//
METHOD SaveRow( Val ) CLASS TList
For nI := 1 To Len( ::aList[1] )
::aList[::Pos,nI]:=Val[ni]
Next
Return (NIL)
//-----------------------------------
METHOD BlankRow() CLASS TList
Local aStru:={}, x
FOR X:=1 To LEN(::aList[1])
if valtype(::aList[1,x])=="N"
aadd(aStru,0)
elseif valtype(::aList[1,x])=="C"
aadd(aStru,space(len(::aList[1,x])))
elseif valtype(::aList[1,x])=="L"
aadd(aStru,.f.)
elseif valtype(::aList[1,x])=="D"
aadd(aStru,CTOD(""))
else
aadd(aStru,NIL)
endif
next
Return(aStru)
[/img][/quote][/code]