no me funciona este codigo
ya he probado muchas formas si alguien me da una mano muy agradecido
- Code: Select all Expand view RUN
- #include 'fivewin.ch'
#include 'xbrowse.ch'
function main()
local aKeys := {'pichincha','internacio'}
local hBancos := { => }
local hRow
local aCols := {}
local oWnd
local oBrw
local i
local oCol1
local cDbf := '.\test1.dbf'
local aDbf := { { 'codigo' , 'C', 10, 0 } ,;
{ 'pichincha' , 'C', 15, 0 } ,;
{ 'internacio' , 'C', 15, 0 } }
hBancos ['pichincha'] = {}
hRow = { 'numcuenta' => '1234567' }
aadd( hBancos ['pichincha'], hRow )
hBancos ['internacio'] = {}
hRow = { 'numcuenta' => '890123' }
aadd( hBancos ['internacio'], hRow )
dbcreate( cDbf, aDbf )
use ( cDbf ) new alias camello exclusive
camello->( dbappend() )
camello->codigo = '1'
camello->( dbappend() )
camello->codigo = '2'
camello->( dbgotop() )
DEFINE WINDOW oWnd
@ 0,0 XBROWSE oBrw OF oWnd alias 'camello' fastedit
oCol1 := oBrw:AddCol()
oCol1:bEditValue := { || ( oBrw:cAlias )->codigo }
oCol1:cHeader := "codigo"
oCol1:cEditPicture:= "@!"
oCol1:nEditType := 0
oCol1:nWidth := 90
aCols = {}
for i = 1 to len( aKeys )
aadd( aCols, oBrw:AddCol() )
campotexto( oBrw, i+1, @aCols, i, hBancos, aKeys )
next
oBrw:CreateFromCode()
ACTIVATE WINDOW oWnd
return nil
function campotexto( oBrw, i, aCols, n, hBancos, aKeys )
local xValue
local uRet
local c
local aRow
local aEditListTxt
local aEditListBound
local j
local hRow
aRow = hBancos[ aKeys[n] ]
aEditListTxt = {}
aEditListBound = {}
for j = 1 to len( aRow )
hRow = aRow[j]
aadd( aEditListTxt , hRow['numcuenta'] )
aadd( aEditListBound, hRow['numcuenta'] )
next
c = alltrim( lower( ( oBrw:cAlias )->( fieldname( i ) ) ) )
do case
case c $ 'pichincha'
aCols[ n ]:bEditValue := { || ( oBrw:cAlias )->pichincha }
//xbrowser aCols[ n ]:bEditValue
case c $ 'internacional'
aCols[ n ]:bEditValue := { || ( oBrw:cAlias )->internacio }
case c $ 'produbanco'
aCols[ n ]:bEditValue := { || ( oBrw:cAlias )->produbanco }
case c $ 'guayaquil'
aCols[ n ]:bEditValue := { || ( oBrw:cAlias )->guayaquil }
case c $ 'bolivariano'
aCols[ n ]:bEditValue := { || ( oBrw:cAlias )->bolivarian }
case c $ 'delazuay'
aCols[ n ]:bEditValue := { || ( oBrw:cAlias )->delazuay }
case c $ 'machala'
aCols[ n ]:bEditValue := { || ( oBrw:cAlias )->machala }
end
aCols[ n ]:cHeader := c
aCols[ n ]:cEditPicture := "@!"
aCols[ n ]:nEditType := EDIT_LISTBOX
aCols[ n ]:nWidth := 120
aCols[ n ]:aEditListTxt := aEditListTxt //{'deposito','anticipo'}
aCols[ n ]:aEditListBound := aEditListBound //{'DP','AN'}
do case
case c $ 'pichincha'
aCols[ n ]:bOnPostEdit := { |o,v| ( oBrw:cAlias )->pichincha := v }
case c $ 'internacional'
aCols[ n ]:bOnPostEdit := { |o,v| ( oBrw:cAlias )->internacio := v }
case c $ 'produbanco'
aCols[ n ]:bOnPostEdit := { |o,v| ( oBrw:cAlias )->produbanco := v }
case c $ 'guayaquil'
aCols[ n ]:bOnPostEdit := { |o,v| ( oBrw:cAlias )->guayaquil := v }
case c $ 'bolivariano'
aCols[ n ]:bOnPostEdit := { |o,v| ( oBrw:cAlias )->bolivarian := v }
case c $ 'delazuay'
aCols[ n ]:bOnPostEdit := { |o,v| ( oBrw:cAlias )->delazuay := v }
case c $ 'machala'
aCols[ n ]:bOnPostEdit := { |o,v| ( oBrw:cAlias )->machala := v }
end
return uRet
gracias por su tiempo
Wilson