Agregar registro a dbf vacia con txbrowse
Posted: Mon Sep 22, 2008 7:27 pm
Hola amigos del foro:
Alguno de ustedes podría orientarme sobre ¿cómo agregar un registro en txbrowse sobre una dbf en blanco?
La idea es utilizar exclusivamente txbrowse sin ningún diálogo o gets externos.
El siguiente es el último código, (lo he intentado de diferentes maneras pero no logro hacerlo). Agradeceré mucho su ayuda.
Error description: Error BASE/1004 Class: 'NIL' has no exported method: EVAL
Args:
[ 1] = U
Stack Calls
===========
Called from: => EVAL(0)
Called from: XBrowse.PRG => TXBRWCOLUMN:EDIT(5984)
Called from: XBrowse.PRG => TXBROWSE:KEYCHAR(1639)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: CONTROL.PRG => TXBROWSE:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: C:\FWH712\pruebas2\TBAR\mibarra.prg => MAIN(153)
//----------------------------
Function CDiario(oRecta,oBar)
local oChild, oBrw, oCol, cOldSele:=Select()
local n:=0
local cAlias:=cGetNewAlias("CDIAR")
local aCampos := {"CTA","SCTA","SSCTA","SSSCTA","SSSSCTA","DESCRIP","DEBE","HABER","CONCEPTO"}
local aHeaders:= {"CTA","SCT1","SCT2","SCT3","SCTA4","DESCRIPCION DE LA CUENTA","DEBITOS","CREDITOS","CONCEPTO"}
local aWidths:= {32,32,32,32,32,250,90,90,300}
Wmdata->( __dbCopyStruct( cAlias, { } ) )
DbUseArea(.t.,,cAlias,cAlias,.f.)
dbSelectArea(cAlias)
DEFINE WINDOW oChild MDICHILD OF oWnd TITLE "EDICION COMPROBANTE DE DIARIO " + cAlias ;
FROM 0, oRecta:nWidth+1 TO oWnd:nHeight-140, oWnd:nWidth-4 PIXEL
oBrw := TXBrowse():New( oChild )
oBrw:cAlias := cAlias
oBrw:nColDividerStyle := LINESTYLE_INSET
oBrw:nRowDividerStyle := LINESTYLE_INSET
oBrw:lColDividerComplete := .t.
oBrw:nHeaderHeight := 30 //Altura cabeceras de col
oBrw:lFooter := .t. //Que tendrá footer
oBrw:nFooterLines := 1 //Lineas del footer
oBrw:nFooterHeight := 24 //Altura del Footer
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:lFastEdit := .t.
For n:=1 to len( aCampos )
oCol:=oBrw:AddCol(aCampos[n])
oCol:cHeader := aHeaders[n]
oCol:nWidth := aWidths[n]
oCol:nEditType := 1
oCol:bOnPostEdit := {|o, u, n| if(n == VK_RETURN, Edita(o,u,oBrw),) }
Next
oBrw:CreateFromCode()
oChild:oClient := oBrw
ACTIVATE WINDOW oChild ;
ON INIT ( if(oBrw:nDataLines ==0, ( (oBrw:cAlias)->(dbAppend()),oBrw:Refresh() ),), oBrw:SetFocus() ) ;
VALID ( (cAlias)->(dbCloseArea()), Ferase( ".\"+cAlias+".dbf" ), dbSelectArea(cOldSele), .T. )
RETURN NIL
Saludos.
Alguno de ustedes podría orientarme sobre ¿cómo agregar un registro en txbrowse sobre una dbf en blanco?
La idea es utilizar exclusivamente txbrowse sin ningún diálogo o gets externos.
El siguiente es el último código, (lo he intentado de diferentes maneras pero no logro hacerlo). Agradeceré mucho su ayuda.
Error description: Error BASE/1004 Class: 'NIL' has no exported method: EVAL
Args:
[ 1] = U
Stack Calls
===========
Called from: => EVAL(0)
Called from: XBrowse.PRG => TXBRWCOLUMN:EDIT(5984)
Called from: XBrowse.PRG => TXBROWSE:KEYCHAR(1639)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: CONTROL.PRG => TXBROWSE:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TMDIFRAME:ACTIVATE(0)
Called from: C:\FWH712\pruebas2\TBAR\mibarra.prg => MAIN(153)
//----------------------------
Function CDiario(oRecta,oBar)
local oChild, oBrw, oCol, cOldSele:=Select()
local n:=0
local cAlias:=cGetNewAlias("CDIAR")
local aCampos := {"CTA","SCTA","SSCTA","SSSCTA","SSSSCTA","DESCRIP","DEBE","HABER","CONCEPTO"}
local aHeaders:= {"CTA","SCT1","SCT2","SCT3","SCTA4","DESCRIPCION DE LA CUENTA","DEBITOS","CREDITOS","CONCEPTO"}
local aWidths:= {32,32,32,32,32,250,90,90,300}
Wmdata->( __dbCopyStruct( cAlias, { } ) )
DbUseArea(.t.,,cAlias,cAlias,.f.)
dbSelectArea(cAlias)
DEFINE WINDOW oChild MDICHILD OF oWnd TITLE "EDICION COMPROBANTE DE DIARIO " + cAlias ;
FROM 0, oRecta:nWidth+1 TO oWnd:nHeight-140, oWnd:nWidth-4 PIXEL
oBrw := TXBrowse():New( oChild )
oBrw:cAlias := cAlias
oBrw:nColDividerStyle := LINESTYLE_INSET
oBrw:nRowDividerStyle := LINESTYLE_INSET
oBrw:lColDividerComplete := .t.
oBrw:nHeaderHeight := 30 //Altura cabeceras de col
oBrw:lFooter := .t. //Que tendrá footer
oBrw:nFooterLines := 1 //Lineas del footer
oBrw:nFooterHeight := 24 //Altura del Footer
oBrw:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oBrw:lFastEdit := .t.
For n:=1 to len( aCampos )
oCol:=oBrw:AddCol(aCampos[n])
oCol:cHeader := aHeaders[n]
oCol:nWidth := aWidths[n]
oCol:nEditType := 1
oCol:bOnPostEdit := {|o, u, n| if(n == VK_RETURN, Edita(o,u,oBrw),) }
Next
oBrw:CreateFromCode()
oChild:oClient := oBrw
ACTIVATE WINDOW oChild ;
ON INIT ( if(oBrw:nDataLines ==0, ( (oBrw:cAlias)->(dbAppend()),oBrw:Refresh() ),), oBrw:SetFocus() ) ;
VALID ( (cAlias)->(dbCloseArea()), Ferase( ".\"+cAlias+".dbf" ), dbSelectArea(cOldSele), .T. )
RETURN NIL
Saludos.