xBrowse com array problemas !
Posted: Thu Apr 19, 2007 7:36 pm
Amigos, estou tento problemas quando preciso recarregar a ARRAY.
Acontece, que ao dar o comando:
uBrw:SetArray(bStruc,.t.)
uBrw:refresh()
Esta desconfigurando as colunas da browse.
fonte:
uBrw := TXBrowse():New( oDlp )
bStruc :={{"","Sim",0,CTOD(""),CTOD(""),0}}
uBrw:SetArray( bStruc, .t. )
uBrw:aCols[1]:cHeader := "Parcela"
ubrw:aCols[3]:nWidth := 50
uBrw:aCols[1]:cEditPicture := "999"
uBrw:aCols[1]:bClrEdit := uBrw:bClrStd
uBrw:aCols[1]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 1 ] := x }
uBrw:aCols[2]:cHeader := "Recebida"
ubrw:aCols[3]:nWidth := 60
uBrw:aCols[2]:nDataStrAlign := AL_LEFT
uBrw:aCols[2]:nHeadStrAlign := AL_LEFT
uBrw:aCols[2]:nEditType := EDIT_LISTBOX
uBrw:aCols[2]:aEditListTxt := {"Sim", "Não"}
uBrw:aCols[2]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 2 ] := x }
uBrw:aCols[2]:aEditListBound := {"Sim", "Não"}
uBrw:aCols[2]:bClrEdit := uBrw:bClrStd
uBrw:aCols[3]:cHeader := "Valor"
ubrw:aCols[3]:nWidth := 70
uBrw:aCols[3]:cEditPicture := "@E 999,999.99"
uBrw:aCols[3]:nDataStrAlign := AL_RIGHT
uBrw:aCols[3]:nHeadStrAlign := AL_RIGHT
uBrw:aCols[3]:bOnPostEdit := {|o,x| bStruc[uBrw:nArrayAt, 3 ] := x }
uBrw:aCols[3]:nEditType := EDIT_GET
uBrw:aCols[3]:bStrData := {|| TRANS(bStruc[uBrw:nArrayAt, 3 ] ,"@E 999,999.99")}
uBrw:aCols[4]:cHeader := padc("Vencimento",11)
ubrw:aCols[3]:nWidth := 80
uBrw:aCols[4]:nDataStrAlign := AL_CENTER
uBrw:aCols[4]:nHeadStrAlign := AL_CENTER
uBrw:aCols[4]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 4 ] := x }
uBrw:aCols[4]:nEditType := EDIT_GET
uBrw:aCols[5]:cHeader := padc("Data Pgto",11)
ubrw:aCols[3]:nWidth := 80
uBrw:aCols[5]:nDataStrAlign := AL_CENTER
uBrw:aCols[5]:nHeadStrAlign := AL_CENTER
uBrw:aCols[5]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 5 ] := x }
uBrw:aCols[5]:nEditType := EDIT_GET
uBrw:aCols[6]:cHeader := "Valor Pgto"
ubrw:aCols[6]:nWidth := 70
uBrw:aCols[6]:cEditPicture := "@E 999,999.99"
uBrw:aCols[6]:nDataStrAlign := AL_RIGHT
uBrw:aCols[6]:nHeadStrAlign := AL_RIGHT
uBrw:aCols[6]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 6 ] := x}
uBrw:aCols[6]:nEditType := EDIT_GET
uBrw:aCols[6]:bStrData := {|| TRANS(bStruc[uBrw:nArrayAt, 6 ],"@E 999,999.99")}
uBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
uBrw:nColDividerStyle := LINESTYLE_DARKGRAY
uBrw:lColDividerComplete := .t.
uBrw:nFooterLines := 2
uBrw:lFooter := .t.
uBrw:aCols[ 1 ]:cFooter := "Total:"
uBrw:bClrStd := { ||{ RGB(0,0,0), iif( uBrw:nArrayAt % 2 == 0, RGB(234,255,234) , RGB(255,255,255) ) } }
uBrw:nFreeze := 6
uBrw:lHScroll := .f.
uBrw:lVScroll := .f.
uBrw:lFastEdit := .T. //ENTER cod barras
uBrw:CreateFromResource( 101 )
***********************************************************
STATIC FUNCTION CRIA_TITULOS(cocond,iniciemis,tivalor,uBrw)
***********************************************************
LOCAL X,vvaltotal:=0,calcv:=0,ultparc
select condicoes
dbsetorder(1)
if dbseek(cocond)
bStruc:={}
calcv :=round(tivalor/condicoes->co_parc,2)
Select TabCondicoes
dbsetorder(1)
dbseek(str(cocond,4,0))
do while TabCondicoes->pg_codi==cocond .and. TabCondicoes->(! eof())
iniciemis+=TabCondicoes->pg_praz
AADD(bStruc,{TabCondicoes->pg_nupa,"Sim",calcv,iniciemis,ctod(""),0})
TabCondicoes->(dbskip())
enddo
IF LEN(bStruc)>0
vvaltotal:=0
ultparc :=len(bStruc)
FOR X:=1 TO (LEN(bStruc)-1)
vvaltotal+=round(bStruc[x][3],2)
NEXT
bStruc[ultparc][3]:=round(tivalor-vvaltotal,2)
else
bStruc :={{"","Sim",0,CTOD(""),CTOD(""),0}}
ENDIF
uBrw:SetArray(bStruc,.t.) ***aqui o problema
uBrw:refresh() ***esta desconfigurando as colunas
endif
RETURN(.T.)
O que estou fazendo de errado?
Desde já agradeço
Aokisantos
Acontece, que ao dar o comando:
uBrw:SetArray(bStruc,.t.)
uBrw:refresh()
Esta desconfigurando as colunas da browse.
fonte:
uBrw := TXBrowse():New( oDlp )
bStruc :={{"","Sim",0,CTOD(""),CTOD(""),0}}
uBrw:SetArray( bStruc, .t. )
uBrw:aCols[1]:cHeader := "Parcela"
ubrw:aCols[3]:nWidth := 50
uBrw:aCols[1]:cEditPicture := "999"
uBrw:aCols[1]:bClrEdit := uBrw:bClrStd
uBrw:aCols[1]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 1 ] := x }
uBrw:aCols[2]:cHeader := "Recebida"
ubrw:aCols[3]:nWidth := 60
uBrw:aCols[2]:nDataStrAlign := AL_LEFT
uBrw:aCols[2]:nHeadStrAlign := AL_LEFT
uBrw:aCols[2]:nEditType := EDIT_LISTBOX
uBrw:aCols[2]:aEditListTxt := {"Sim", "Não"}
uBrw:aCols[2]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 2 ] := x }
uBrw:aCols[2]:aEditListBound := {"Sim", "Não"}
uBrw:aCols[2]:bClrEdit := uBrw:bClrStd
uBrw:aCols[3]:cHeader := "Valor"
ubrw:aCols[3]:nWidth := 70
uBrw:aCols[3]:cEditPicture := "@E 999,999.99"
uBrw:aCols[3]:nDataStrAlign := AL_RIGHT
uBrw:aCols[3]:nHeadStrAlign := AL_RIGHT
uBrw:aCols[3]:bOnPostEdit := {|o,x| bStruc[uBrw:nArrayAt, 3 ] := x }
uBrw:aCols[3]:nEditType := EDIT_GET
uBrw:aCols[3]:bStrData := {|| TRANS(bStruc[uBrw:nArrayAt, 3 ] ,"@E 999,999.99")}
uBrw:aCols[4]:cHeader := padc("Vencimento",11)
ubrw:aCols[3]:nWidth := 80
uBrw:aCols[4]:nDataStrAlign := AL_CENTER
uBrw:aCols[4]:nHeadStrAlign := AL_CENTER
uBrw:aCols[4]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 4 ] := x }
uBrw:aCols[4]:nEditType := EDIT_GET
uBrw:aCols[5]:cHeader := padc("Data Pgto",11)
ubrw:aCols[3]:nWidth := 80
uBrw:aCols[5]:nDataStrAlign := AL_CENTER
uBrw:aCols[5]:nHeadStrAlign := AL_CENTER
uBrw:aCols[5]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 5 ] := x }
uBrw:aCols[5]:nEditType := EDIT_GET
uBrw:aCols[6]:cHeader := "Valor Pgto"
ubrw:aCols[6]:nWidth := 70
uBrw:aCols[6]:cEditPicture := "@E 999,999.99"
uBrw:aCols[6]:nDataStrAlign := AL_RIGHT
uBrw:aCols[6]:nHeadStrAlign := AL_RIGHT
uBrw:aCols[6]:bOnPostEdit := {|o,x| bStruc[ uBrw:nArrayAt, 6 ] := x}
uBrw:aCols[6]:nEditType := EDIT_GET
uBrw:aCols[6]:bStrData := {|| TRANS(bStruc[uBrw:nArrayAt, 6 ],"@E 999,999.99")}
uBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
uBrw:nColDividerStyle := LINESTYLE_DARKGRAY
uBrw:lColDividerComplete := .t.
uBrw:nFooterLines := 2
uBrw:lFooter := .t.
uBrw:aCols[ 1 ]:cFooter := "Total:"
uBrw:bClrStd := { ||{ RGB(0,0,0), iif( uBrw:nArrayAt % 2 == 0, RGB(234,255,234) , RGB(255,255,255) ) } }
uBrw:nFreeze := 6
uBrw:lHScroll := .f.
uBrw:lVScroll := .f.
uBrw:lFastEdit := .T. //ENTER cod barras
uBrw:CreateFromResource( 101 )
***********************************************************
STATIC FUNCTION CRIA_TITULOS(cocond,iniciemis,tivalor,uBrw)
***********************************************************
LOCAL X,vvaltotal:=0,calcv:=0,ultparc
select condicoes
dbsetorder(1)
if dbseek(cocond)
bStruc:={}
calcv :=round(tivalor/condicoes->co_parc,2)
Select TabCondicoes
dbsetorder(1)
dbseek(str(cocond,4,0))
do while TabCondicoes->pg_codi==cocond .and. TabCondicoes->(! eof())
iniciemis+=TabCondicoes->pg_praz
AADD(bStruc,{TabCondicoes->pg_nupa,"Sim",calcv,iniciemis,ctod(""),0})
TabCondicoes->(dbskip())
enddo
IF LEN(bStruc)>0
vvaltotal:=0
ultparc :=len(bStruc)
FOR X:=1 TO (LEN(bStruc)-1)
vvaltotal+=round(bStruc[x][3],2)
NEXT
bStruc[ultparc][3]:=round(tivalor-vvaltotal,2)
else
bStruc :={{"","Sim",0,CTOD(""),CTOD(""),0}}
ENDIF
uBrw:SetArray(bStruc,.t.) ***aqui o problema
uBrw:refresh() ***esta desconfigurando as colunas
endif
RETURN(.T.)
O que estou fazendo de errado?
Desde já agradeço
Aokisantos