Xbrowse Builder having a strange error (SOLVED)
Posted: Tue Jan 04, 2022 9:36 pm
I was desingning a xbrowsebuilder that reads all info from dbf and build it with 1 line. It was working good, but while changing some code a error occured that I can't solve.
The forum has several topics about the error, but I don't see the solution because I don't know where it comes from.
I call the browse like this : It is inside a folder system where all folders have this line of code
I know that the function is processing several lines with values, but at a given moment the data seems to be fault, mayby NIL like I saw on a post...
Any tips, help please ?
Application
===========
Path and name: C:\marc32\factumat32.exe (32 bits)
Size: 7,395,328 bytes
Compiler version: Harbour 3.2.0dev (r2008190002)
FiveWin version: FWH 21.06
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 3 secs
Error occurred at: 04/01/2022, 21:53:21
Error description: Error BASE/1004 No exported method: VALUE
Args:
[ 1] = U
Stack Calls
===========
Called from: => VALUE( 0 )
Called from: .\TEST1.PRG => STYLEBROWSE( 751 )
Called from: .\TEST1.PRG => GETXBROWSER( 2151 )
Called from: .\TEST1.PRG => MARC_FOLDER_KLANTEN( 618 )
Called from: .\TEST1.PRG => (b)MAIN( 160 )
The code position of the error (insite stylebrowse)
FOR EACH cCol in aBarget
WITH OBJECT oBrwSel:oCol( cCol )
:uBarGetVal := uValBlank( :Value ) ///// THIS IS THE LINE WITH THE ERROR !!!!!
:cBarGetPic := :cEditPicture
The forum has several topics about the error, but I don't see the solution because I don't know where it comes from.
I call the browse like this : It is inside a folder system where all folders have this line of code
I know that the function is processing several lines with values, but at a given moment the data seems to be fault, mayby NIL like I saw on a post...
Any tips, help please ?
Application
===========
Path and name: C:\marc32\factumat32.exe (32 bits)
Size: 7,395,328 bytes
Compiler version: Harbour 3.2.0dev (r2008190002)
FiveWin version: FWH 21.06
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.2, Build 9200
Time from start: 0 hours 0 mins 3 secs
Error occurred at: 04/01/2022, 21:53:21
Error description: Error BASE/1004 No exported method: VALUE
Args:
[ 1] = U
Stack Calls
===========
Called from: => VALUE( 0 )
Called from: .\TEST1.PRG => STYLEBROWSE( 751 )
Called from: .\TEST1.PRG => GETXBROWSER( 2151 )
Called from: .\TEST1.PRG => MARC_FOLDER_KLANTEN( 618 )
Called from: .\TEST1.PRG => (b)MAIN( 160 )
The code position of the error (insite stylebrowse)
FOR EACH cCol in aBarget
WITH OBJECT oBrwSel:oCol( cCol )
:uBarGetVal := uValBlank( :Value ) ///// THIS IS THE LINE WITH THE ERROR !!!!!
:cBarGetPic := :cEditPicture
Code: Select all | Expand
//Folder 2
oBrw[2] = getXBrowser("KLANTDOCUMENTEN",oFld:aDialogs[2]) // KLANTDOCUMENTEN is the reference to the callling browsedata
// Folder 3
oBrw[3] = getXBrowser("KLANTPERSONEN",oFld:aDialogs[3])
// Folder 4
oBrw[4] = getXBrowser("FACTUREN",oFld:aDialogs[4])
...
function getXbrowser(cData,oTarget)
local aBrw:={}, aVelden:={}, aHeads:={}, aSizes:={}, aFields:={}
local aBrwget:={}, aBrwedit:={}
local cDbf, cZoek:="", cIndex
Local nTop:=0, nLeft:=0, nBreed:=0, nHoogte:=0, cRelation:=""
local cVelden:="", cHeaders:="", cSizes:="", cBrwget:="", cBrwedit:=""
FIELD brwnaam,klant_nr,document // Xbrowsers
cData = upper(cData)
// get the browse data, position, etc...
netopen("brwsetup","Code","TempXb")
select TempXB
set filter to brwnaam = cData
tempXB->(dbgotop())
cDbf = alltrim(tempXb->database)
cIndex = alltrim(tempXb->index)
cMaster = alltrim(tempXb->master)
nTop = tempXb->top
nLeft = tempXb->left
nBreed = tempXb->Breed
nHoogte = tempXb->hoogte
cRelation = alltrim(tempXb->relation)
close tempXb
// get de browse fields data and headers
netopen("brwdetail","Code","TempXb")
select tempXb
set filter to brwnaam = cData
tempXb->(dbgotop())
do while !tempXb->(eof())
if tempXb->sel_bar
aadd(aBrwGet,tempXb->brnaam)
endif
if tempXb->sel_edit
aadd(aBrwEdit,tempXb->brnaam)
endif
aadd(aVelden,alltrim(tempXb->veld))
aadd(aHeads,alltrim(tempXb->brnaam))
aadd(aSizes,tempXb->size)
tempXb->(dbskip())
enddo
close tempXb
netopen(cDbf)
select (cDbf)
// if there is a relation for the browse, set it here
// This data will be next to put inside the dbf
// testing if use set relation .... or the function
if !empty(cRelation)
do case
case cData = "KLANTPERSONEN"
select (cMaster)
set relation to upper(klant_nr) into persoon scoped ADDITIVE
select (cDbf)
case cData = "FACTUREN"
select (cMaster)
set relation to upper(klant_nr) into facturen scoped ADDITIVE
select (cDbf)
case cData = "KLANTFACTART"
select (cMaster)
( cMaster )->( ORDSETRELATION( "factart" , { || document }, "document" ) )
( cMaster )->(dbgotop())
case cData = "KLANTDOCUMENTEN"
( cMaster )->( ORDSETRELATION( "factinfo" , { || UPPER(klant_nr) }, "UPPER(klant_nr)" ) )
select (cDbf)
endcase
( cDbf )->(dbgotop())
endif
// generate the browse
@ nTop,nLeft XBROWSE oBrw size nBreed,nHoogte PIXEL OF oTarget font oFont ;
DATASOURCE cDbf ;
COLUMNS aVelden ;
HEADERS aHeads ;
COLSIZES aSizes ;
AUTOSORT CELL LINES NOBORDER FOOTERS
/* Here the problem is starting I guess. I had this working, but
while changing some code, it will give a error to the stylebrowse function
at least I think so
*/
StyleBrowse(oBrw, aBrwGet, aBrwEdit ,cData ) // while give the browse the style we want
oBrw:CreateFromCode()
oBrw:setfocus()
if !empty(cRelation) // else it whill refresh to much i think
oBrw:gotop()
oBrw:refresh()
endif
return oBrw
Static Function StyleBrowse( oBrwSel, aBarget, aEditget, cNaam )
local cCol,cTemp
LOCAL hBmp := ReadBitmap( 0, "bitmaps\search.bmp" )
DEFAULT aBarget:={}
DEFAULT aEditget:={}
DEFAULT cNaam:=""
if lPijama // Make stripes in the browse
oBrwSel:bClrStd = { || If( oBrwSel:KeyNo() % 2 == 0, ;
{ If( ( oBrwSel:cAlias )->( Deleted() ), CLR_HRED, nClrTxtBrw ),;
CLR_BROWSE2 }, ;
{ If( ( oBrwSel:cAlias )->( Deleted() ), CLR_HRED, nClrTxtBrw ),;
CLR_BROWSE1 } ) }
oBrwSel:bClrSel = { || { If( ( oBrwSel:cAlias )->( Deleted() ), CLR_HRED, nClrBackBrw ),;
CLR_BROWSEROW } }
else
oBrwSel:bClrStd := { || { If( ( oBrwSel:cAlias )->( Deleted() ), CLR_HRED, nClrTxtBrw ),;
nClrBackBrw } }
oBrwSel:bClrSel := { || { If( ( oBrwSel:cAlias )->( Deleted() ), CLR_HRED, nClrBackBrw ),;
MY_PAARS } }
endif
cClrBack := Eval( oBrwSel:bClrSelFocus )[ 2 ] // I don't know what this is doing
oBrwSel:SetChecks()
oBrwSel:bRClickHeaders := { || XbrColSelector( oBrwSel, cNaam ) } // Kies welke velden tezien zijn
WITH OBJECT oBrwSel
:l2007 := .F.
:lFooter := .T.
:bRecSelHeader := {|| "Klant" } // will become the dbf name
:bRecSelData := {| o | o:KeyNo }
:bRecSelFooter := {| o | o:nLen }
:oRecSelFont := oFont // optional
:nRecSelWidth := "99999" // required size
:lColChangeNotify := .T.
:nMarqueeStyle := MARQSTYLE_HIGHLROW
:lHScroll := .F.
:lFullGrid := .T.
:lMultiSelect := .T.
:lRowDividerComplete := .T.
:lColDividerComplete := .T.
:nColDividerStyle := LINESTYLE_LIGHTGRAY
:nRowDividerStyle := LINESTYLE_LIGHTGRAY
:bClrSelFocus := {|| { CLR_WHITE, CLR_BROWSECEL } } // CUANDO TIENE EL FOCUS
:bClrRowFocus := {|| { CLR_WHITE, CLR_BROWSEROW } }
:nHeaderHeight := 23
:oHeaderFonts := oBold
:nHeadStrAligns := AL_CENTER
//:nFooterHeight := oBrwSel:nHeaderHeight
:nRowHeight := oBrwSel:nHeaderHeight
:nStretchCol := NIL // -2 // STRETCHCOL_WIDEST
:nFreeze := 1
if lPijama
:SetColor( CLR_BLACK, RGB( 232, 255, 232 ) ) // Pink
else
:SetColor( nClrTxtBrw, nClrBackBrw )
endif
END
// code for showing the bargetdata(Gets in the browse)
oBrwSel:lGetBar := .T. // Button to activate
if len(aBarget)>0
FOR EACH cCol in aBarget
WITH OBJECT oBrwSel:oCol( cCol )
:uBarGetVal := uValBlank( :Value )
:cBarGetPic := :cEditPicture
:bClrEdit := {|| { CLR_BLACK, MY_LIGHTYELLOW } }
:lBarGetOnKey := .T. // after having setfocus the oBrowse object, the end user can insert the characters directly into the get
:cBarGetBmp := hBmp // this for show the Bitmap on the get
:bBarGetAction := {|| ( oBrwSel:cAlias )->( MARC_SETFILTER( oBrwSel ) ) } // this for show the bitmap on the get and associated a action
END
NEXT
endif
// Code for selecting (from the browse) witch fields can be edited
// aEditget = headernames that can be edited
if len(aEditget)>0
FOR EACH cCol in aEditget
WITH OBJECT oBrwSel:oCol( cCol )
:nEditType := EDIT_GET
:bClrHeader := {|| { CLR_WHITE, CLR_BROWSEINDEX } }
END
NEXT
endif
Return nil