Xbrowse Builder having a strange error (SOLVED)

Xbrowse Builder having a strange error (SOLVED)

Postby Marc Venken » 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





Code: Select all  Expand view  RUN

//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










 
Last edited by Marc Venken on Sat Jan 29, 2022 10:23 am, edited 3 times in total.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse Builder having a strange error

Postby Marc Venken » Tue Jan 04, 2022 9:41 pm

If I call the function separately, it seems to work.

So when I comment out the function call to stylebrowse insite the getxbrowser function and call it like this, it seems to work.

//It is like this now and the call to stylebrowse if included (post above)
oBrw[4] = getXBrowser("FACTUREN",oFld:aDialogs[4])


// here I deleted the call from getxbrowser and call it separate (then it seems to go), but before it was working

oBrw[4] = getXBrowser("FACTUREN",oFld:aDialogs[4])
StyleBrowse(oBrw[4],{ "factuur","klantnum" },{ "factuur","klantnum" })
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse Builder having a strange error (RESOLVED)

Postby Marc Venken » Tue Jan 04, 2022 10:38 pm

Absolut strange and no idea at all why this is the solution, or even why it triggers a error...
I spend hours of debugging.

I changed the array for the fields/headers to a alltrim, so that the headers would be centered nicely into the browse. Centering works, but it triggers that strange error.

//aadd(aVelden,alltrim(tempXb->veld))
//aadd(aHeads,alltrim(tempXb->brnaam))

Changing it back to this : NO ALLTRIM and the error is gone (but me headers are not centered.

aadd(aVelden,tempXb->veld)
aadd(aHeads,tempXb->brnaam)

I would surely like to know why this was giving a error.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse Builder having a strange error (RESOLVED)

Postby Marc Venken » Tue Jan 04, 2022 10:45 pm

Team Fivewin : Maybe this is a bug ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse Builder having a strange error (RESOLVED)

Postby Antonio Linares » Thu Jan 06, 2022 11:32 am

Dear Marc,

Mr. Rao is the right one to answer you about it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Xbrowse Builder having a strange error (RESOLVED)

Postby cnavarro » Thu Jan 06, 2022 7:56 pm

Mark, in your initial code:
Code: Select all  Expand view  RUN


.../...
    StyleBrowse(oBrw, aBrwGet, aBrwEdit ,cData )  // while give the browse the style we want

   oBrw:CreateFromCode()
.../...
 


try with

Code: Select all  Expand view  RUN

.../...
   oBrw:CreateFromCode()

   StyleBrowse(oBrw, aBrwGet, aBrwEdit ,cData )  // while give the browse the style we want
   oBrw:Refresh()
.../...
 

and tell me
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6552
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Xbrowse Builder having a strange error (RESOLVED)

Postby Marc Venken » Thu Jan 06, 2022 8:37 pm

Changing the code give the same error.


So strange that when I use the alltrim function it craches with the error
and whithout alltrim it works. I wanted the alltrim because then the browse headers would be centered nice.

So only changing these 2 lines trigger the error.. No idea

//aadd(aVeld,alltrim(tempXb->veld))
//aadd(aKop,alltrim(tempXb->brnaam))

aadd(aVeld,tempXb->veld)
aadd(aKop,tempXb->brnaam)
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse Builder having a strange error (RESOLVED)

Postby Marc Venken » Thu Jan 06, 2022 8:44 pm

If we can confirm that it is not possible that the alltrim of the array can trigger the error, than I will build a sample with FW sample data dbf's
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse Builder having a strange error (RESOLVED)

Postby Antonio Linares » Fri Jan 07, 2022 8:27 am

Marc,

Do you mean this error ?

Error description: Error BASE/1004 No exported method: VALUE
Args:
[ 1] = U

Stack Calls
===========
Called from: => VALUE( 0 )
Called from: .\TEST1.PRG => STYLEBROWSE( 751 )

Do you still get the same error ? You are sending a message to a nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Xbrowse Builder having a strange error (RESOLVED)

Postby Marc Venken » Fri Jan 07, 2022 10:18 am

Antonio Linares wrote:Marc,

Do you mean this error ?

Error description: Error BASE/1004 No exported method: VALUE
Args:
[ 1] = U

Stack Calls
===========
Called from: => VALUE( 0 )
Called from: .\TEST1.PRG => STYLEBROWSE( 751 )

Do you still get the same error ? You are sending a message to a nil


Yes... I know that it is strange even weird that this triggers the error. I only change the // in front of the 2 lines with alltrim and recompile.

//aadd(aVelden,alltrim(tempXb->veld))
//aadd(aHeads,alltrim(tempXb->brnaam))

Changing it back to this : NO ALLTRIM and the error is gone

aadd(aVelden,tempXb->veld)
aadd(aHeads,tempXb->brnaam)

I will make a working sample with this strange error.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse Builder having a strange error (RESOLVED)

Postby Antonio Linares » Fri Jan 07, 2022 6:48 pm

Dear Marc,

Are tempXb->veld and tempXb->brnaam both strings ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Xbrowse Builder having a strange error

Postby Marc Venken » Fri Jan 07, 2022 8:49 pm

Both are str values yes.

Here is the sample that will trigger the error.

The sample program will build 2 dbf files and cdx files that are used and not inside the FW samples folder

this is the line the error refers to

:uBarGetVal := uValBlank( :Value )

If you however uncommend on row 571 the 2 lines with the alltrim inside and use the 2 others, it works

// With alltrim = error // alltrim will work

aadd(aVeld,alltrim(tempXb->veld))
aadd(aKop,alltrim(tempXb->brnaam))
//aadd(aVeld,tempXb->veld)
//aadd(aKop,tempXb->brnaam)

Is you change this then you see a simple 'customer' tag and the 2 folders. 1 = xbrowse and 2 = from the XBrwbuilder

The 2 arrays involved are :

aBarget = to manage fields that the barget of xbrowse will allow to enter for filtering purposes
aEditget = to magane fields that will be alowed to edit inside the browse

Code: Select all  Expand view  RUN


// \SAMPLES\MARC2.PRG  - 09/12/2021 - Modified by: Joao - Version 1.2

#include "fivewin.ch"
#include "Directry.ch"
#include "inkey.ch"
#include 'ord.ch'
#include "ribbon.ch"
#include 'xbrowse.ch'

#define MY_GREEN   nRGB( 145, 214, 124)
#define MY_LIGHTGREEN nRGB( 236, 255, 224)
#define MY_LIGHTYELLOW nRGB( 255, 251, 142)
#define MY_LIGHTBLUE nRGB( 214, 229, 255)
#define MY_PAARS nRGB( 232, 201, 255)
#define MY_YELLOW nRGB( 255, 220, 96)
#Define CLR_BROWSE1     nRGB( 214, 229, 255 )
#Define CLR_BROWSE2     nRGB( 229, 237, 246 )
#Define CLR_BROWSECEL   nRGB(   0,  75, 125 )
#Define CLR_BROWSEROW   nRGB(  73, 118, 185 )
#Define CLR_BROWSEINDEX nRGB( 156, 156, 156 )

#Define CLR_LGREEN     nRGB( 190, 215, 190 )
#Define CLR_SOFTYELLOW nRGB( 255, 251, 225 )
#Define CLR_PINK       nRGB( 255, 128, 128 )
#Define CLR_NBLUE      nRGB( 128, 128, 192 )
#Define CLR_MSPURPLE   nRGB( 0,   120, 215 )
#Define CLR_MSRED      nRGB( 232,  17,  35 )
#Define CLR_MSGRAY     nRGB( 229, 229, 229 )
#define CLR_LIGHTBLUE  nRGB( 214, 229, 255)

ANNOUNCE RDDSYS
REQUEST OrdKeyNo, OrdKeyCount, OrdCreate, OrdKeyGoto
REQUEST DBFCDX, DBFFPT

STATIC oWnd, oDlg, oFont, cClrBack, oBold
STATIC oDlgRB[ 3 ]
STATIC SERVER_PATH, LOCAL_PATH, oFld, CDRIVE, cLocal
STATIC lServer := .F.
//  ADDED BY MARC

STATIC oKlant , oRec
static sys_dbf:={}

static nClrTxtBrw      := CLR_BLACK
static nClrBackBrw     := CLR_WHITE
static lPijama         := .T.

FUNCTION Main()

   LOCAL sys_versie := "Dec 2021 - 02/12"
   LOCAL cErrorLogFileName := "MyLog.log"
   LOCAL oFol, oDlg, oRBar, oMenu, oMenuWnd, oBrush1, oGr, oGr1, oGr2, oGr3, ;
         oGr9, oSay1, oBmp, oFont1, oCursor, oBtn2, oBtn3, oBtn4
   LOCAL aBitmaps := { "..\bitmaps\alphabmp\facebook.bmp",;
                       "..\bitmaps\alphabmp\windows.bmp",;
                       "..\bitmaps\alphabmp\game.bmp",;
                       "..\bitmaps\alphabmp\viddler.bmp",;
                       "..\bitmaps\alphabmp\mail.bmp",;
                       "..\bitmaps\alphabmp\call.bmp",;
                       "..\bitmaps\alphabmp\settings2.bmp",;
                       "..\bitmaps\alphabmp\exit.bmp" }

   RDDSETDEFAULT("DBFCDX")

   SET CENTURY ON
   SET DATE BRITISH
   SET TIME FORMAT TO "HH:MM:SS"
   SET EPOCH TO YEAR( DATE() ) - 30
   SET SOFTSEEK OFF
   SET WRAP ON
   SETCANCEL( .F. )
   SET CONFIRM OFF
   SET DELETED ON
   SET _3DLOOK ON
   SET UNIQUE OFF
   SET ESCAPE OFF
   SET EXACT ON
   SET EXCLUSIVE OFF
   SET MULTIPLE OFF

   SERVER_PATH := "\\CAROLIEN-PC\MARC\"

   //LOCAL_PATH  := CURDRIVE()+"
:\MARC\"

   LOCAL_PATH  := "
c:\fwharb\samples\"
   cLocal      := "
C:\fwharb\samples\"           // DEZE MOET


   cDrive      := "
" //"C:\MARC\"                     // DEZE MOET

   FW_SetUnicode( .T. )

   SetBalloon( .T. ) // Balloon shape required for tooltips

   SkinButtons()

   SetGetColorFocus( MY_LIGHTGREEN )

   Forumsetup()  // Make forumdatabases for testing

   xbrNumFormat( "
E", .T. )  // "E" for European, "A" for American and others // .t. for showing thousand separators

   DEFINE FONT oFont1 NAME "
Arial" SIZE 0, - 15 // BOLD

   DEFINE CURSOR oCursor HAND
   DEFINE BRUSH oBrush1 COLOR nRGB( 223, 233, 244 )

   DEFINE WINDOW oWnd TITLE "
Maveco Bedrijfskleding " + FWVERSION ;
      FROM 0, 0 TO 1030, 1920 pixel MDI MENU oMenu BRUSH oBrush1

   DEFINE RIBBONBAR oRBar WINDOW oWnd PROMPT "
Klanten", "Leveranciers", "Ingeven Documenten";
      HEIGHT 130 TOPMARGIN 25

//  Databases =============================
   ADD GROUP oGr  RIBBON oRBar TO OPTION 1 PROMPT "
Databases" width 130 ;
      BITMAP "
bitmaps\fivetech.BMP"

   @ 02, 05 ADD BUTTON oBtn2 GROUP oGr BITMAP "
bitmaps\cut16.BMP" ;
      SIZE 75, 20 PROMPT "
Customers"  MOSTLEFT round ;
      action ( Marc_FolderEx(oWnd) )

   ADD GROUP oGr2  RIBBON oRBar TO OPTION 1 PROMPT "
Documents" width 130 ;
      BITMAP "
bitmaps\fivetech.BMP"


//  X-Browsers =============================

   ADD GROUP oGr7  RIBBON oRBar TO OPTION 1 PROMPT "
XBrowsers" width 130 ;
      BITMAP "
bitmaps\fivetech.BMP"

   ADD GROUP oGr9 RIBBON oRBar TO OPTION 1 PROMPT "
Exit" width 70 ;
      BITMAP "
bitmap\fivetech.bmp"

//  Exit =============================

   @ 15, 20 ADD BUTTON oBtn4 GROUP oGr9 BITMAP "
bitmaps\32x32\quit.BMP" ;
      SIZE 34, 52 PROMPT "
Exit" action( oWnd:End() )

   SET MESSAGE OF oWnd TO "
Version : " + sys_versie ;
      CENTERED CLOCK KEYBOARD 2007

   WndCenter( oWnd:hWnd )

   ACTIVATE WINDOW oWnd MAXIMIZED


   oBrush1:End()
   oRBar:End()

RETURN NIL


FUNCTION MyErrorAction( cErrorLogFileName, oError )

   LOCAL cErrScreen := "
"

   MsgInfo( "
Er is een fout opgetreden in het programma.  Gelieve het programma opnieuw te starten" )

RETURN NIL

FUNCTION lookup_klant( cKlant )
   //  This will be a lookup function for customersdata
   msginfo( cKlant )

RETURN NIL


FUNCTION NETOPEN( cFile, cIndex, cAlias, lMode, nSeconds, lNewArea, cDriver, ;
                  lReadOnly )

   LOCAL nWaitTime, lContinue := .T., lSuccess := .F., TSEL := 0

   DEFAULT lMode     :=  .T.                     // shared mode
   DEFAULT cIndex := "
"
   DEFAULT nSeconds  :=  3
   DEFAULT cAlias    := cFile
   DEFAULT lNewArea  :=  .T.
   DEFAULT cDriver   := "
DBFCDX"
   DEFAULT lReadOnly :=  .F.

   //SET DEFAULT TO LOCAL_PATH
   //SET DEFAULT TO "
c:\marc32\"

   nWaitTime := nSeconds

   cFile := AllTrim( cFile ) + "
.dbf"

   IF lServer

      cFile := server_path + cFile

      msginfo(cFile)

      IF .NOT. FILE( cFile )

         MsgInfo( "
Database not created on server correctly.", "Attention" )

         RETURN( .F. )

      ENDIF

   ELSE

      cFile := local_path + cFile

      IF .NOT. FILE( cFile )

         MsgInfo( "
Database not created Local correctly. "+cFile, "Attention" )

         RETURN( .F. )

      ENDIF

   ENDIF

   // File exist ?

   IF ! File( cFile )

      Exit( "
Bestand " + CFILE + ".DBF is afwezig" )

   ENDIF

   // verify driver is valid
   IF AScan( rddList(), cDriver ) == 0

      MSGSTOP( "
Driver " + Cdriver + "  afwezig" )

      Exit()

   ENDIF

   // Indien reeds geopend, alles ok, select waar

   IF Select( cAlias ) # 0

      MsgInfo( "
File : " + cAlias + " is reeds geopend" )

      TSEL := Select( cAlias )

      Select( TSEL )

      lContinue := .T.
      lNewArea  := .F.

   ENDIF
   */
   // while continuing to attempt open
   WHILE lContinue // while .not. timed-out

      SYSREFRESH()

      WHILE nSeconds > 0 .AND. lContinue

         SYSREFRESH()
         // dbUseArea( lNewArea, cDriver, cFile, cAlias, ( .not. lMode ), lReadOnly )

         dbUseArea( lNewArea, cDriver, cFile, cAlias, lMode, lReadOnly )
         /*
         IF !lMode
            USE &cFile ALIAS &cAlias NEW EXCLUSIVE
         ELSE
            USE &cFile ALIAS &cAlias NEW SHARED
         ENDIF
          */
         // check for success/failure
         IF NetErr()
            nSeconds--
            lSuccess  := .F.
         ELSE
            // open successful
            nSeconds  := 0
            lSuccess  := .T.
            lContinue := .F.
         ENDIF

      ENDDO

      IF .NOT. lSuccess

         nSeconds  := nWaitTime

         MSGSTOP( "
Bestand " + CFILE + " Alias : " + cAlias + " is geopend door een andere gebruiker" + CRLF + CRLF + "Gelieve even te wachten" )

         lSuccess  := .F.
         lContinue := .T.
         lNewArea  := .T.

      ENDIF

      IF !Empty( cIndex )

         &cAlias->( dbSetOrder( cIndex ) )

      ENDIF

   ENDDO

RETURN lSuccess



CLASS TSeek STATIC //  From Xbrowse seek function ?

   DATA oBrw

   METHOD New( oBrw ) CONSTRUCTOR
   METHOD SetText( c ) INLINE ::oBrw:RefreshFooters()

ENDCLASS

METHOD New( oBrw ) CLASS TSeek  //  From Xbrowse seek function ?

   ::oBrw   := oBrw

RETURN Self

FUNCTION del_row( oBrw )

   IF MsgYesNo( "
Deze regel wissen" )

      oBrw:delete()

   ENDIF

RETURN NIL

FUNCTION Exit( cErrInfo )

   cErrInfo += CRLF + "
Gelieve deze fout te melden" + CRLF + CRLF + ;
                      "
Het Programma zal nu eindigen"

   CLOSE ALL

   MSGSTOP( cErrInfo )

   SET RESOURCES TO

   ErrorLevel( 1 )

   DbCommitAll()
   DbUnLockAll()
   DbCloseAll()
   FreeResources()
   Release All
   SysRefresh()
   HB_GCALL( .T. )

   CLEAR MEMORY

   PostQuitMessage( 0 )

   QUIT

RETURN NIL

FUNCTION Marc_FolderEx( oWnd )

   //  Locals added by Marc
   local oFont1,oBold,oFont,oFont3,oFonts,oFontXS
   local cCol, oBrush
   LOCAL aVelden := ARRAY(10)  // oBrw[10]
   LOCAL oBrw    := ARRAY(10)  // oBrw[10]
   LOCAL hBmp    := ReadBitmap( 0, "
bitmaps\search.bmp" )

   //
   LOCAL oDlg, oFld, oBarDialog, cTitle, aGrad, oOk, oExit
   LOCAL cDenominazione := "
I LOVE FIVEWIN THE BEST OF THE WORLD!            "
   LOCAL cIndirizzo     := "
AVENUE ATLANTICA, 1200 - LEBLON - RIO DE JANEIRO."
   LOCAL oSay      := ARRAY(4)
   LOCAL aGet      := ARRAY(4)
   LOCAL cCompl    := REPLICATE( "
.",  9 )
   LOCAL oSilDrawLi
   LOCAL SilDrawLi := REPLICATE( "
_", 50 )
   LOCAL EmailSilv := SPACE(50)


   //OpenDatabases("
KLANTEN")

   cTitle := "
Marc Informatica Corporation: Systems Folders"

   SET _3DLOOK ON

   SetGetColorFocus( CLR_LGREEN ) // COR EM TODOS OS GETS DOS DIALOGOS.

   tGet():lDisColors  := .F.   // WHEN( .F. ) COR.
   tGet():nClrTextDis := CLR_HBLUE
   tGet():nClrPaneDis := CLR_SOFTYELLOW

   SetBalloon( .T. ) // Balloon shape required for tooltips

   SkinButtons()

   aGrad := { { 1, CLR_WHITE, CLR_LIGHTBLUE } }

   DEFINE FONT oFont1 NAME "
Ms Sans Serif" SIZE 0, - 8 BOLD
   DEFINE FONT oBold NAME 'CALIBRI' SIZE 0, - 12 BOLD
   DEFINE FONT oFont NAME "
CALIBRI" SIZE 0, - 14
   DEFINE FONT oFont3 NAME "
Segoe UI" SIZE 0, - 12
   DEFINE FONT oFontS NAME "
Segoe UI" SIZE 0, - 09
   DEFINE FONT oFontXS NAME "
Segoe UI" SIZE 0, - 08

   DEFINE BRUSH oBrush FILE "
Bitmaps\BackGrnd\Stone.bmp"

   DEFINE DIALOG oDlg FROM 60,0 to 750,1900 PIXEL TRUEPIXEL TITLE cTitle;
      GRADIENT aGrad

   oDlg:lHelpIcon := .F.

   DEFINE BUTTONBAR oBarDialog OF oDlg SIZE 80, 80 2007 BOTTOM NOBORDER

   @ 3, 3 FOLDEREX oFld SIZE oDlg:nWidth, oDlg:nHeight - oBarDialog:nheight  ;
      PROMPT "
Basic", "Builder" ;
      BITMAPS "
..\bitmaps\alphabmp\Facebook.bmp",                            ;
              "
..\bitmaps\alphabmp\viddler.bmp"                              ;
      FONT oFont PIXEL COLOR CLR_MSGRAY TAB HEIGHT 25 ROUND 5

   oFld:aEnable = { .T., .T. }
   oFld:SetOption( 1 )
   oFld:Show()

   // Marc, write the code here on the spot.

   //  FOLDER 1  -----------------------------------------------------------------------------------------------

   aVelden[1] :=  { ;
      { "
ID", "ID", NIL,  90 }, ;
      { "
First", "First", NIL,  350 }, ;
      { "
Last", "Last", NIL, 300 }, ;
      { "
Street", "Street", NIL, 300 }, ;
      { "
City", "City", NIL, 200 }, ;
      { "
Zip", "Zip", NIL, 150 } }

   @ 0, 0 XBROWSE oBrw[ 1 ] size - 05, - 20 PIXEL OF oFld:aDialogs[ 1 ] font oFont ;
      DATASOURCE "
customer" ;
      COLUMNS aVelden[1] ;
      AUTOSORT CELL LINES NOBORDER FOOTERS

   WITH OBJECT oBrw[ 1 ]
      :bKeyDown   := {| k | IF ( K == VK_DELETE, Del_row( oBrw[ 1 ] ), NIL ) }
      // Designing is here

   END
   oBrw[ 1 ]:CreateFromCode()
   oBrw[ 1 ]:setfocus()

   //  FOLDER 2  -----------------------------------------------------------------------------------------------

   oBrw[2] = getXBrowser("
CUSTOMERS",oFld:aDialogs[2])

   //  FOLDER 3  -----------------------------------------------------------------------------------------------
   //  FOLDER 4  -----------------------------------------------------------------------------------------------

   //  END FOLDERS

   @ 630, 150 BUTTON oOk   PROMPT "
Send &Marc" SIZE 120, 30 OF oDlg PIXEL    ;
      ACTION( oDlg:End() )

   @ 630, 300 BUTTON oExit PROMPT "
&Exit"      SIZE 120, 30 OF oDlg PIXEL       ;
      ACTION( oDlg:End() ) DEFAULT CANCEL

   SET FONT OF oOk   TO oFont
   SET FONT OF oExit TO oFont

   ACTIVATE DIALOG oDlg CENTERED


   IF Set( _SET_INSERT, ! Set( _SET_INSERT ) )
      Set( _SET_INSERT, ! Set( _SET_INSERT ) )
   ENDIF

   oFont:End()
   close all

RETURN NIL



FUNCTION MARC_SETFILTER( oBrw ) // SETFILTER()?? INTERN COMMAND.

   LOCAL cFilter := "
"
   LOCAL n, oCol, uVal, cType

   FOR n := 1 TO Len( oBrw:aCols )

      oCol  := oBrw:aCols[ n ]

      IF ! Empty( uVal := oCol:uBarGetVal )

         IF !Empty( cFilter )
            cFilter  += "
.AND. "
         ENDIF

         cType    := ValType( uVal )

         DO CASE
         CASE cType == 'C'
            uVal     := Upper( AllTrim( uVal ) )
   // cFilter += '"
' + uVal + '" $ UPPER( ' + FieldName( n ) + " )"
            cFilter += '"
' + uVal + '" $ UPPER( ' + oCol:CExpr + " )"
         OTHERWISE
   // cFilter  += FieldName( n ) + "
== " + cValToChar( uVal )
            cFilter  += oCol:cExpr + "
== " + cValToChar( uVal )
         ENDCASE
      ENDIF

   NEXT
   // ******************************
   // /
   // msginfo(cFilter)
   // msgGet( "
title", "message", @cFilter )

   IF Empty( cFilter )

      IF ! Empty( dbFilter() )
         dbClearFilter()
         oBrw:Refresh()
      ENDIF

   ELSE

      IF !( dbFilter() == cFilter )
         SET FILTER TO &cFilter
         GO TOP
         oBrw:Refresh()
      ENDIF

   ENDIF

   oBrw:SetFocus()

RETURN NIL

function getXbrowser(cData,oTarget)
  local aBrw:={}, aVeld:={}, aKop:={}, 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)
  //  Haal de basisdata
  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
  //  Haal de detaildata
  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

    // Here is the code that will trigger the error

    // With alltrim = error  // alltrim will work

    aadd(aVeld,alltrim(tempXb->veld))
    aadd(aKop,alltrim(tempXb->brnaam))
    //aadd(aVeld,tempXb->veld)
    //aadd(aKop,tempXb->brnaam)


    aadd(aSizes,tempXb->size)

    tempXb->(dbskip())
  enddo
  close tempXb
  //netopen(cDbf,cIndex)
  netopen(cDbf)
  select (cDbf)

  @ nTop,nLeft XBROWSE oBrw size nBreed,nHoogte PIXEL OF oTarget font oFont ;
      DATASOURCE cDbf ;
      COLUMNS aVeld ;
      HEADERS aKop ;
      COLSIZES aSizes ;
      AUTOSORT CELL LINES NOBORDER FOOTERS

   // Is nog een issue mee
   oBrw:CreateFromCode()

   StyleBrowse(oBrw, aBrwGet, aBrwEdit ,cData )

   oBrw:refresh()

   oBrw:setfocus()

return oBrw

Static Function StyleBrowse( oBrwSel, aBarget, aEditget, cNaam )
   LOCAL hBmp    := ReadBitmap( 0, "
bitmaps\search.bmp" )
   local cCol,cTemp
   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" }
      :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
   //  Toon de Bargetdata (Gets boven Bar)

   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
// //         :bBarGetAction := {|| ( oBrwSel:cAlias )->( SETFILTER( oBrwSel ) ) } // this for show the bitmap on the get and associated a action

         END

      NEXT


   endif
   */


   if len(aEditget)>0
      //xbrowser(aEditget) title oBrwSel:cAlias()
      FOR EACH cCol in aEditget
         //msginfo(cCol+oBrwSel:cAlias(),"
Info")
         WITH OBJECT oBrwSel:oCol( cCol )
            :nEditType     := EDIT_GET
            :bClrHeader    := {|| { CLR_WHITE, CLR_BROWSEINDEX } }
            //msginfo(cCol+oBrwSel:cAlias(),"
Info Done")
         END
      NEXT
   endif

   */
Return nil


//  For xbrowse data there is a brwmanager
// Just for the forum sampler
function forumsetup()
local aFields:={}, aF2:={}
cFile = "
brwsetup.dbf"
IF .NOT. FILE( cFile )

      aFields := { { "
BRWNAAM", "C", 15, 0 },;
                   { "
TOP", "N", 4, 0 },;
                   { "
LEFT", "N", 4, 0 },;
                   { "
BREED", "N", 4, 0 },;
                   { "
HOOGTE", "N", 4, 0 },;
                   { "
DATABASE", "C", 15, 0 },;
                   { "
RELATION", "C", 200, 0 },;
                   { "
INDEX", "C", 15, 0 },;
                   { "
INFO", "C", 250, 0 },;
                   { "
MASTER", "C", 10, 0 } }

  DbCreate( "
brwsetup.dbf", aFields, "DBFCDX" )
  use brwsetup NEW VIA "
DBFCDX"
  index on upper(brwnaam) tag code
  append blank
  brwsetup->brwnaam = "
CUSTOMERS"
  brwsetup->DATABASE = "
CUSTOMER"

  close brwsetup

endif

cFile = "
brwdetail.dbf"
IF .NOT. FILE( cFile )

      aF2       := { { "
VELD", "C", 15, 0 },;
                   { "
BRNAAM", "C", 15, 0 },;
                   { "
SIZE", "N", 3, 0 },;
                   { "
SEL_BAR", "L", 1, 0 },;
                   { "
SEL_EDIT", "L", 1, 0 },;
                   { "
ORDER", "N", 4, 0 },;
                   { "
TOP", "N", 4, 0 },;
                   { "
LEFT", "N", 4, 0 },;
                   { "
BREED", "N", 4, 0 },;
                   { "
HOOGTE", "N", 4, 0 },;
                   { "
BRWNAAM", "C", 20, 0 },;
                   { "
PIC", "C", 20, 0 },;
                   { "
ALIGN", "N", 1, 0 },;
                   { "
DATABASE", "C", 15, 0 } }

  DbCreate( "
brwdetail.dbf", aF2, "DBFCDX" )
  USE brwdetail NEW VIA "
DBFCDX"
  INDEX ON upper(brwnaam)+str(order) TAG CODE
  append blank
  brwdetail->veld = "
ID"
  brwdetail->brnaam = "
ID"
  brwdetail->size = 100
  brwdetail->sel_bar = .T.
  brwdetail->sel_edit = .f.
  brwdetail->order = 1000
  brwdetail->brwnaam = "
CUSTOMERS"

  append blank
  brwdetail->veld = "
FIRST"
  brwdetail->brnaam = "
First"
  brwdetail->size = 250
  brwdetail->sel_bar = .T.
  brwdetail->sel_edit = .T.
  brwdetail->order = 1010
  brwdetail->brwnaam = "
CUSTOMERS"

  close brwdetail
endif

return NIL


Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse Builder having a strange error

Postby Marc Venken » Tue Jan 25, 2022 12:12 pm

Can someone test this sample and see if you also have the error ?
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Xbrowse Builder having a strange error

Postby Otto » Wed Jan 26, 2022 9:30 am

Hello Mark,
Sure, I help with testing.
Can you please copy the dbf fiels somewhere?
Customer.dbf is not compatible with which I have.
Also, for creating the files, we have to change the path.

Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6364
Joined: Fri Oct 07, 2005 7:07 pm

Re: Xbrowse Builder having a strange error

Postby Marc Venken » Wed Jan 26, 2022 9:57 am

Otto wrote:Hello Mark,
Sure, I help with testing.
Can you please copy the dbf fiels somewhere?
Customer.dbf is not compatible with which I have.
Also, for creating the files, we have to change the path.

Best regards,
Otto


The sample should build de dbf's. The customer dbf is from the samples ?
But Yes, I can place the dbf's for download. Between 12.00 13.00 h
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1456
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 91 guests