Solicito ayuda al foro...
El error presentado en el archivo error.log (anexo), es esporádico, pero se presenta en la mayoría de mis clientes uno o dos veces al día. Uso txbrowse dentro de un método propio para mantenimiento de tablas, el error NO se da siempre con la misma tabla (método de mantenimiento ). Se me esta convirtiendo en un problema, dado que no es fácil reproducir el momento del error.
// error.log
Application
===========
Path and name: D:\RUSSOFT\ZERUS\ZERUSWIN.EXE (32 bits)
Size: ********* bytes
Compiler version: xHarbour 1.2.3 Intl. (SimpLex) (Build 20141202)
FiveWin Version: FWHX 15.01
Windows version: 6.1, Build 7601 Service Pack 1
Time from start: 0 hours 53 mins 22 secs
Error occurred at: 02/29/2016, 10:20:21
Error description: Error DBCMD/2001 Workarea not in use: DBGOTO
Stack Calls
===========
Called from: => DBGOTO( 0 )
Called from: source\classes\xbrowse.prg => (b)TXBROWSE:SETRDD( 4162 )
Called from: source\classes\xbrowse.prg => (b)TXBROWSE:TXBROWSE( 445 )
Called from: => TXBROWSE:_BOOKMARK( 0 )
Called from: source\classes\xbrowse.prg => TXBROWSE:PAINT( 1630 )
Called from: source\classes\xbrowse.prg => TXBROWSE:DISPLAY( 1376 )
Called from: Source\Classes\control.prg => TCONTROL:HANDLEEVENT( 1699 )
Called from: source\classes\xbrowse.prg => TXBROWSE:HANDLEEVENT( 12700 )
Called from: Source\Classes\window.prg => _FWH( 3450 )
Called from: => WINRUN( 0 )
Called from: Source\Classes\window.prg => TWINDOW:ACTIVATE( 1152 )
Called from: C:\Desarro\ZerusGes\VersionActual\FUENTES\COMUNES\FW_FUNCSST3.PRG => PRINCIPAL_METRO( 5014 )
Called from: C:\Desarro\ZerusGes\VersionActual\FUENTES\COMUNES\FW_FUNCSST1.PRG => PRINCIPAL( 1241 )
Called from: C:\Desarro\ZerusGes\VersionActual\FUENTES\MAIN\ZerusMain.prg => ZERUSMAIN( 2697 )
Called from: C:\Desarro\ZerusGes\VersionActual\FUENTES\MAIN\ZerusWin.prg => MAIN( 16 )
System
======
CPU type: Intel(R) Xeon(R) CPU X3450 @ 2.67GHz 75 Mhz
Hardware memory: 1 megs
Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %
//*****************************************************************
// método que marca el inicio del error -> PRINCIPAL_METRO( 5014 )
FUNCTION PRINCIPAL_METRO()
LOCAL oBrush,hborland,oCursor,oCursorPen,oFont, oFon
LOCAL cDirAct := DISKNAME()+":"+XDIRNAME()+"\"+cCodCia
LOCAL oTimer , oSprite , oIco,oPopup3, oPopup2
LOCAL cTipCon := "", cImaFon, SW := 0
PRIVATE lActFun := .F.
MEMVAR oBar, Omenu
PUBLIC oImageList, oToolBar, oBa1r, oBar, Omenu
IF M->lProEje
MYMEN("Error. El programa ya esta en ejecuci¢n")
RETURN NIL
ENDIF
CLOSE ALL
M->lProEje := .T.
DEFINE ICON oIco FILENAME "IMAGENES\zeruswin.ico"
SetResDebug(.t.)
DEFINE WINDOW oWnd FROM 0, 0 TO 46, 128 ;
TITLE HB_OEMTOANSI("Russoft. Sistema de Gesti¢n Empresarial " + ;
"(Versi¢n : "+m->cFecVerZer+")"+ " | "+ cCiaAct +" - "+ cCiaNom ) ;
ICON oIco ;
MENU MenuPrincipal(oWnd)
LINEAESTADOFW(oWnd)
ACTIVATE WINDOW oWnd MAXIMIZED ;
VALID ( TerminarMetro(oBrush,m->oMetWin), .T. ) ;
ON INIT ( m->oMetWin := MakeMetroPanelPrincipal( oWnd,oBrush ) ,;
m->oMetWin:Show(), ;
oTimer := XTimers() )
SET KEY VK_ESCAPE TO
CHECKRES()
M->lProEje := .F.
RETURN ( oWnd )
//***************************************************************************************
método de la clase xbrowse.prg
METHOD SetRDD( lAddColumns, lAutoOrder, aFldNames, aRows ) CLASS TXBrowse
local oCol, aStruct
local cAlias, cAdsKeyNo, cAdsKeyCount
local nFields, nFor, n, uData
local bOnSkip
IF SELECT(::cAlias) == 0
RETURN NIL
ENDIF
if Empty( ::cAlias )
::cAlias := Alias()
if Empty( ::cAlias )
return nil
endif
endif
if ::lCreated
if ::nDataType == DATATYPE_RDD
if SameDbfStruct( Self, Alias() )
return nil
endif
endif
::cAlias := Alias()
::ClearBlocks()
::aCols := {}
endif
TRY
DEFAULT lAddColumns := Empty( ::aCols ) .or. ! Empty( aFldNames )
DEFAULT lAutoOrder := ::lAutoSort
::lAutoSort := lAutoOrder
cAlias := ::cAlias
if ValType( aRows ) == 'A' .and. Len( aRows ) > 0
if ValType( aRows[ 1 ] ) == 'A'
bOnSkip := { | oBrw | ( oBrw:cAlias )->( DbGoTo( oBrw:aArrayData[ oBrw:nArrayAt ][ 1 ] ) ) }
else
bOnSkip := { | oBrw | ( oBrw:cAlias )->( DbGoTo( oBrw:aArrayData[ oBrw:nArrayAt ] ) ) }
endif
::SetArray( aRows, .f., 0, .f., bOnSkip )
::nDataType := nOr( DATATYPE_RDD, DATATYPE_ARRAY )
lAutoOrder := .f.
else
::nDataType := DATATYPE_RDD
endif
::lSqlRDD := ( ( ::cAlias )->( RddName() ) == "SQLRDD" )
if ::lSqlRDD
DEFAULT ::bKeyNo := { |n| 0 }
endif
IF SELECT(::cAlias) == 0 // si la tabla no esta en uso o el alias no existe, etc... porque no se detecta aquí ?
BREAK
ENDIF
// ERROR EN ESTE DEFAULT -> Error description: Error DBCMD/2001 Workarea not in use: DBGOTO
DEFAULT ::bGoTop := {|| ( ::cAlias )->( DbGoTop() ) },;
::bGoBottom := {|| ( ::cAlias )->( DbGoBottom() ) },;
::bSkip := {| n | ( ::cAlias )->( DbSkipper( IfNil( n, 1 ) ) ) },;
::bBof := {|| ( ::cAlias )->( Bof() ) },;
::bEof := {|| ( ::cAlias )->( Eof() ) },;
::bBookMark := {| n | iif( n == nil .or. n == 0 ,;
( ::cAlias )->( RecNo() ) ,;
( ::cAlias )->( DbGoto( n ) ) ) }
If ( "ADS"$( ::cAlias )->( RddName() ) .or. 'ADT' $ ( ::cAlias )->( RddName() ) ) .and. ;
( ::cAlias )->( LastRec() ) > 200
// Modified in FWH 9.06
// AdsGetRelKeyPos() returns approximate position as % and when multipilied by 100 and rounded off
// returns incorrect values occassionally on smaller tables. OrdKeyNo() mapped to AdsKeyNo() gives reliable
// result in such cases. For large tables OrdKeyNo() is unacceptably slow. Limit of 200 is chosen because
// 0.5% is 1/200.
cAdsKeyNo := "{| n, Self | iif( n == nil, " +;
"Round( " + cAlias + "->( ADSGetRelKeyPos() ) * Self:nLen, 0 ), "+;
cAlias + "->( ADSSetRelKeyPos( n / Self:nLen ) ) ) }"
cAdsKeyCount := "{|| " + cAlias + "->( ADSKeyCount(,,1) )}"
DEFAULT ::bKeyNo := &cAdsKeyNo ,;
::bKeyCount := &cAdsKeyCount
::lRelyOnKeyNo := .f.
else
DEFAULT ::bKeyNo := {| n | iif( n == nil,;
( ::cAlias )->( OrdKeyNo() ),;
( ::cAlias )->( OrdKeyGoto( n );
) ) },;
::bKeyCount := {|| ( ::cAlias )->( If( ( ::cAlias )->( eof() ) .and. ( ::cAlias )->( bof() ) , 0, ( ::cAlias )->( OrdKeyCount() ) ) ) }
::lRelyOnKeyNo := If( Set( _SET_DELETED ), "DELETED()" $ Upper( ( ::cAlias )->( DbFilter() ) ), .t. )
Endif
if ::lSqlRDD
::lRelyOnKeyNo := .f.
endif
::lReadOnly := ( ( ::cAlias )->( DbInfo( DBI_ISREADONLY ) ) == .t. )
aStruct := ( ::cAlias )->( dbstruct() )
if lAddColumns
if Empty( aFldNames )
aFldNames := { '*' }
endif
for each uData in aFldNames
if ValType( uData ) == 'C' .and. uData == '*'
for nFor := 1 to ( ::cAlias )->( FCount() )
( ::cAlias )->( SetColFromRDD( ::AddCol(), nFor ) )
next
else
( ::cAlias )->( SetColFromRDD( ::AddCol(), uData, aStruct ) )
endif
next
endif
(::cAlias)->( OrderTagInfo( aStruct, 8 ) )
for nFor := 1 to Len( ::aCols )
if ( n := AScan( aStruct, { |a| a[ 1 ] == Upper( ::aCols[ nFor ]:cHeader ) } ) ) > 0
::aCols[ nFor ]:cSortOrder := aStruct[ n ][ 8 ]
::aCols[ nFor ]:cOrdBag := ( cAlias )->( OrdBagName( ::aCols[ nFor ]:cSortOrder ) )
endif
next nFor
DEFAULT ::bSeek := { |c,u| ( ::cAlias )->( ::RddIncrSeek( c, @u ) ) }
if ( ::cAlias )->( DbInfo( DBI_SHARED ) )
::bLock := { || ( ::cAlias )->( DbrLock() ) }
::bUnlock := { || ( ::cAlias )->( DbrUnlock() ) }
endif
::bDelete := { || ( ::cAlias )->( If( ::nLen > 0 .and. Eval( ::bLock ), ( ( ::cAlias )->( DbDelete() ), Eval( ::bUnlock ), ;
If( Set( _SET_DELETED ), ( ( ::cAlias )->( DbSkip(1) ), If( ( ::cAlias )->( Eof() ),( ::cAlias )->( DbGoBottom() ), nil ) ), nil ) ;
), nil ) ) }
if Empty( ::cTitle )
::cTitle := cFileNoExt( ( ::cAlias )->( DBINFO( DBI_FULLPATH ) ) )
endif
if ::lCreated
::Adjust()
::Refresh()
endif
CATCH
END
return nil
//----------------------------------------------------------------------------//
///*** función propia que usa la clase txbrowse
FUNCTION BrowseConsulta2( vConBrw, oPanBrw, cAliTab, fFunDCl,fFunEnt,fFunDel,;
fFunIns,nColPos,fFunMod,cTipCol,cVerFon,nFonBro)
LOCAL oCajDia, cCol, aItem , oBrwFW2 , K := 1, campo, nPosGui := 0
LOCAL A := "IMAGEN", nRecSel := 0, oBrush, oCol , oFont
LOCAL aRowGrad := { { .5, RGB( 232, 241, 252 ), RGB( 232, 241, 252 ) }, ;
{ .5, RGB( 210, 225, 244 ), RGB( 235, 243, 253 ) } }
LOCAL aSelGrad := { { .5, RGB( 255, 255, 251 ), RGB( 255, 237, 178 ) }, ;
{ .5, RGB( 255, 218, 103 ), RGB( 255, 233, 162 ) } }
LOCAL aFont := Array( 5 )
LOCAL oFonBro
set decimals to 2
XbrNumFormat( 'E', .t. )
DEFINE FONT oFont NAME "Arial Narrow" SIZE 5, 19 // 18
DEFAULT nColPos := 1
DEFAULT fFunMod := NIL
SELECT (cAliTab)
nRecSel := (cAliTab)->( RecNo() )
IF EMP->cTipConCon == "N"
DEFINE BRUSH oBrush FILE "IMAGENES\FIVEBACK.JPG"
ELSE
DEFINE BRUSH oBrush FILE "IMAGENES\fondo.jpg"
ENDIF
WITH OBJECT ( oBrwFW2 := TXBrowse():New( oPanBrw ) )
:l2007 := .T.
:nStretchCol := 1
:nMarqueeStyle := 4
:bClrSelFocus := { || { CLR_GREEN, aSelGrad } }
:bClrRowFocus := { || { CLR_GREEN, aRowGrad } }
:bChange := { || nRecSel := oBrwFW2:BookMark }
:nColDividerStyle := LINESTYLE_BLACK
:nRowDividerStyle := LINESTYLE_BLACK
:lColDividerComplete := .T.
:nHeaderLines := 1
:nFooterLines := 1
:nDataLines := 1
:lFooter := .T.
:lFastEdit := .T.
:nFreeze := 1
IF fFunDCl <> NIL
:bLDblClick:= { || &(fFunDCl), oBrwFW2:Refresh() }
ENDIF
:bSeek := {|c| DBSEEK( UPPER(C) ) }
:bkeydown := { | nKey,nFlags | EvaluaTecla(cAliTab,oBrwFW2,@nKey,fFunDCl,fFunEnt,fFunDel,fFunIns,fFunMod,nFlags ) }
//keydown bKeyChar := { |nkey ,nFlags| func1(nkey,nFlags)}
FOR EACH aItem IN vConBrw
WITH OBJECT (oCol := oBrwFW2:AddCol())
:bStrData := MakeValueBlock(@aItem,1, 3 )
:cHeader := HB_OEMTOANSI(aItem[ 2 ])
:nHeadStrAlign := AL_CENTER
IF aItem[ 3 ] <> NIL
:cEditPicture := aItem[ 3 ]
ENDIF
//
IF aItem[ 5 ] <> NIL
:nWidth := aItem[ 5 ] * 8
ELSE
// :nWidth := aItem[ 5 ] * 8 GETTEXTWIDTH(0,REPLICATE("x",vVecAnc[J]),oFonAct:hFont)*nFacFon
ENDIF
IF aItem [ 4 ] // SI ES VERDADERO HABILITA CAPTURA CON GET
:nEditType := 1
:lAutoSave := .F.
:bOnPostEdit := {|o, v, n| IIF ( n != VK_ESCAPE,;
ModificaColumna(oBrwFW2,cAliTab,SUBS(ALLTRIM(aItem[1]),ATNUM('>',aItem[1],1)+1),v,"VALID LOCAL" ), ) }
ENDIF
:oDataFont := oFont
:oHeaderFont := oFont
END
:aCols[ :nFreeze ]:bClrStd := {|| { RGB(0,0,0) ,RGB(234,234,234) } } // CLR_WHITE, CLR_BLUE
NEXT nFor
:aCols[1]:bLClickHeader := {|| ordenaColumna(cAliTab,oBrwFW2,1 ) , oBrwFW2:GoTop(), oBrwFW2:Refresh() }
:aCols[2]:bLClickHeader := {|| ordenaColumna(cAliTab,oBrwFW2,2 ) , oBrwFW2:GoTop(), oBrwFW2:Refresh()}
:cAlias := cAliTab
:SetRDD()
IF cTipCol <> NIL
:SetZebra(.T.,{ { CLR_WHITE, RGB( 234,234,234 ) }, { RGB(0,0,0), RGB( 255,255,242 ) } } )
ELSE
:SetZebra(.T.,{ { RGB(0,0,0), RGB( 234,234,234 ) }, { RGB(0,0,0), RGB( 255,255,242 ) } } )
ENDIF
:CreateFromCode()
:SetFocus()
:oClient := oBrwFW2
:AdjClient()
:SelectCol(nColPos)
:nMoveType = MOVE_NONE
IF cVerFon <> nil
:SetBackGround( oBrush )
ENDIF
END
RETURN BrowseConsulta2 := oBrwFW2
//**********************************
Saludos....
Ing. JONSSON RUSSI TELLO