Page 1 of 1

Problem with xbrowse with tdatabase - Resolved

Posted: Sat May 04, 2019 8:32 am
by Silvio.Falconi
on oldest application to show records with xbrowse I used
1.) create the xbrowse with coordinates
2.) an array aBrowse where I inserted all fields, titles,pictures and sizes
3) then createfromsource comand

I make a small test

Code: Select all

#include "FiveWin.ch"
#include "xBrowse.ch"

static oElementi

REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO

Function test()
Local oDlg,oGrid
Local cDir:= ".\data\"

      RddSetDefault( "DBFCDX" )


     oElementi:=TDatabase():Open( , cDir+"Elementi", "DBFCDX", .T. )
     oElementi:setorder(2)
     oElementi:gotop()


define dialog oDlg size 600,400

     oGrid := TXBrowse():New(oDlg )
     oGrid:nTop    := 00
     oGrid:nLeft   := 10
     oGrid:nBottom := 200
     oGrid:nRight  := 400

 aBrowse   := {  { { || oElementi:ELATTIVO   }, i18n("Attivo"),80, },;
                  { { || oElementi:ELNOME }, i18n("Descrizione elemento"),80, },;
                  { { || ""  }, i18n("Colore "),80, },;
                  { { || oElementi:ELCOLORE }, i18n("Descr. Colore"),80, },;
                  { { || oElementi:ELORDINE }, i18n("Ordine"),80, },;
                  { { || oElementi:ELLOCK }, i18n("Bloccato"),200, }}


   FOR i := 1 TO Len(aBrowse)
      oCol := oGrid:AddCol()
      oCol:bEditValue := aBrowse[ i, 1 ]
      oCol:cHeader  := aBrowse[ i, 2 ]
      oCol:nWidth   := aBrowse[ i, 3 ]
       if !Empty(aBrowse[ i, 4 ])
            oCol:cEditPicture:=aBrowse[ i, 4 ]
         Endif
      NEXT


 WITH OBJECT  oGrid
     :CreateFromCode()
   END

activate dialog oDlg
return nil

I convert EL-> into oElementi why now not run ok ? How I can to have the same ?


now I resolved with

Code: Select all

 @0,nSplit+2 XBROWSE oApp:oGrid SIZE oApp():oDlg:nGridBottom,oApp():oDlg:nGridRight PIXEL OF oApp():oDlg ;
           COLUMNS "ELATTIVO","ELNOME","","ELCOLORE","ELORDINE","ELLOCK";
           HEADERS "Attivo","Descrizione elemento","Colore ", "Descr. Colore","Ordine","Bloccato";
      COLSIZES 80,80,80,80,80,80 ;
      CELL LINES NOBORDER ;
      DATASOURCE oElementi
I'd like to have the same schema also because I build the Xbrowse from an external class (tfsdi) with oApp():oDlg:NewGrid( nSplit )

thanks

Re: Problem with xbrowse with tdatabase

Posted: Sat May 04, 2019 9:11 am
by Silvio.Falconi
on six column I have
WITH OBJECT oApp():oGrid:aCols[6]
:AddResource("BTN_PNG_LOCKSI")
* :AddResource("BTN_PNG_LOCKNO")
:bBmpData := { || IIF( oElementi:ELLOCK,1,) }
:bEditValue := ""
END

but now I see also the value as you can see here
Image

Re: Problem with xbrowse with tdatabase

Posted: Sat May 04, 2019 2:26 pm
by nageswaragunupudi
We advise you NOT to use your old syntax.
Please use it this way.

Code: Select all

#include "FiveWin.ch"

static oElementi

REQUEST DBFCDX

Function test()
Local oDlg,oGrid
Local cDir:= ".\data\"

   RddSetDefault( "DBFCDX" )

   oElementi:=TDatabase():Open( , cDir+"Elementi", "DBFCDX", .T. )
   oElementi:setorder(2)
   oElementi:gotop()

   DEFINE DIALOG oDlg SIZE 600,400

   aBrowse   := { { "ELATTIVO",  i18n("Attivo"), ,              80, },;
                  { "ELNOME",    i18n("Descrizione elemento"),, 80, },;
                  { "",          i18n("Colore "),,              80, },;
                  { "ELCOLORE",  i18n("Descr. Colore"),,        80, },;
                  { "ELORDINE",  i18n("Ordine"),,               80, },;
                  { "ELLOCK",    i18n("Bloccato"),,             200,} }

   @ 00,10 XBROWSE oGrid SIZE -10,00 PIXEL OF oDlg ;
      DATASOURCE oElementi COLUMNS aBrowse

   WITH OBJECT  oGrid
      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg

return nil

Re: Problem with xbrowse with tdatabase

Posted: Sat May 04, 2019 3:35 pm
by Silvio.Falconi
THANKS

Re: Problem with xbrowse with tdatabase

Posted: Sat May 04, 2019 3:47 pm
by Silvio.Falconi
Sorry ,
I made as your code

Code: Select all

 
aBrowse   := { { "ELATTIVO",  i18n("Attivo"),               80, },;
                  { "ELNOME",    i18n("Descrizione elemento"), 80, },;
                  { "",          i18n("Colore "),              80, },;
                  { "ELCOLORE",  i18n("Descr. Colore"),        80, },;
                  { "ELORDINE",  i18n("Ordine"),               80, },;
                  { "ELLOCK",    i18n("Bloccato"),             200,} }


       @0,nSplit+2 XBROWSE oApp:oGrid  ;
           SIZE oApp():oDlg:nGridBottom,oApp():oDlg:nGridRight PIXEL;
           OF oApp():oDlg ;
           DATASOURCE oElementi COLUMNS aBrowse
 
and it make an error ( the same your test corrected)

Code: Select all

Application
===========
   Path and name: C:\Work\Prg\Bikini_scuola\Bikini\main.Exe (32 bits)
   Size: 5,054,464 bytes
   Compiler version: Harbour 3.2.0dev (r1703231115)
   FiveWin  version: FWH 19.03
   C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
   Windows version: 6.2, Build 9200 

   Time from start: 0 hours 2 mins 59 secs 
   Error occurred at: 04-05-2019, 17:44:06
   Error description: Error BASE/1070  Argument error: ==
   Args:
     [   1] = N   80
     [   2] = C   @T

Stack Calls
===========
   Called from: .\source\function\VALTOSTR.PRG => CVALTOSTR( 133 )
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBRWCOLUMN_ADJUST( 11995 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:ADJUST( 12072 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:ADJUST( 1431 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:INITIATE( 1275 )
   Called from:  => __OBJSENDMSG( 0 )
   Called from: .\source\function\HARBOUR.PRG => OSEND( 291 )
   Called from: .\source\function\HARBOUR.PRG => ASEND( 259 )
   Called from: .\source\classes\DIALOG.PRG => TFSDI:INITIATE( 805 )
   Called from: .\source\classes\DIALOG.PRG => TFSDI:ACTIVATE( 330 )
   Called from: source\PElementi.prg => ELEMENTI( 200 )
   Called from: source\main.prg => (b)TAPPLICATION_BUILDRIBBONBAR( 844 )
   Called from: .\source\classes\TRBTN.PRG => TRBTN:CLICK( 717 )
   Called from: .\source\classes\TRBTN.PRG => TRBTN:LBUTTONUP( 917 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1791 )
   Called from: .\source\classes\TRBTN.PRG => TRBTN:HANDLEEVENT( 1575 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3546 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TWINDOW:ACTIVATE( 1078 )

Re: Problem with xbrowse with tdatabase

Posted: Sat May 04, 2019 10:02 pm
by nageswaragunupudi
Mr. Silivio
Sorry.
I revised it and made a minor correction.
Please use the corrected program.

Re: Problem with xbrowse with tdatabase

Posted: Sun May 05, 2019 7:40 am
by Silvio.Falconi
ok wich is the variables on ?

{ field, header, ? , size, ? },;

Re: Problem with xbrowse with tdatabase

Posted: Sun May 05, 2019 7:56 am
by nageswaragunupudi
{ field, header, picture, size, justify, sortorder }

Re: Problem with xbrowse with tdatabase

Posted: Sun May 05, 2019 8:39 am
by Silvio.Falconi
thanks