james

james

Postby Silvio.Falconi » Sat Dec 11, 2021 1:08 pm

where is james bott?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: james

Postby TimStone » Sat Dec 11, 2021 2:49 pm

He has been very busy.


Sent from my iPhone using Tapatalk
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2943
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: james

Postby Silvio.Falconi » Sat Dec 11, 2021 5:24 pm

TimStone wrote:He has been very busy.


Sent from my iPhone using Tapatalk


with tdata seem no work good I not see index tag on combobox
with tdatabase or normal dbf It run ok

Image

Original by Nages ( dbf normal )


Code: Select all  Expand view


#include "fivewin.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oGet, oBrw
   local cSeek := Space( 100 )
   local oFont,oBold


   USE CUSTOMER NEW SHARED VIA "DBFCDX"
    FW_CdxCreate()
   SET ORDER TO TAG FIRST
   GO TOP

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -16
   DEFINE FONT oBold  NAME 'Tahoma' SIZE 0, -14 BOLD

   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL


   @ 21 ,3 SAY oSay1 Prompt "Search " ;
                FONT oBold SIZE 120,20 PIXEL OF oDlg  TRANSPARENT

   @ 20,60 GET oGet VAR cSeek SIZE 200,20 PIXEL OF oDlg
           
 @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE "CUSTOMER" ;
      AUTOCOLS AUTOSORT CELL LINES NOBORDER

   WITH OBJECT oBrw
       :lIncrFilter      := .t.
       :oSeek   := oGet
       :CreateFromCode()
   END

  @ 20 ,  265 Say oSay2 Prompt  "in"  ;
               FONT oBold SIZE  55,   20 PIXEL   OF oDlg

      @ 20, 280  COMBOBOX oBrw:oSortCbx VAR oBrw:cSortOrder;
        SIZE 200,400 PIXEL OF oDlg HEIGHTGET 20 STYLE CBS_DROPDOWN
   ACTIVATE DIALOG oDlg CENTERED

return nil

 




With tdatabase
run ok I see the tag index on combobox
Code: Select all  Expand view

#include "fivewin.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oGet, oBrw
   local cSeek := Space( 100 )
   local oFont,oBold
   local oCust

   oCust:=TDatabase():Open( , "customer", "DBFCDX", .T. )
   oCust:setorder(1)
   oCust:Gotop()

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -16
   DEFINE FONT oBold  NAME 'Tahoma' SIZE 0, -14 BOLD

   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL


   @ 21 ,3 SAY oSay1 Prompt "Search " ;
                FONT oBold SIZE 120,20 PIXEL OF oDlg  TRANSPARENT


   @ 20,60 GET oGet VAR cSeek SIZE 200,20 PIXEL OF oDlg ;
             BITMAP "ELIMINA" ACTION (cSeek    := Space( 100 ),;
             oBrw:Seek( "" ),oBrw:refresh(),oGet:refresh())
             oGet:lBtnTransparent :=.t.

 @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oCust ;
      AUTOCOLS AUTOSORT CELL LINES NOBORDER

   WITH OBJECT oBrw
      :lIncrFilter      := .t.
       :oSeek   := oGet
       :CreateFromCode()
   END

  @ 20 ,  265 Say oSay2 Prompt  "in"  ;
               FONT oBold SIZE  55,   20 PIXEL   OF oDlg

      @ 20, 280  COMBOBOX oBrw:oSortCbx VAR oBrw:cSortOrder;
        SIZE 200,400 PIXEL OF oDlg HEIGHTGET 20 STYLE CBS_DROPDOWN


   ACTIVATE DIALOG oDlg CENTERED

return nil
 



With tdata not work !!!!

(not see the index tag on combox)

Code: Select all  Expand view

#include "fivewin.ch"

REQUEST DBFCDX

//----------------------------------------------------------------------------//

function Main()

   local oDlg, oGet, oBrw
   local cSeek := Space( 100 )
   local oFont,oBold
   local oCust

 

   oCust:=TCust():New()
   oCust:setorder(1)
   oCust:Gotop()


   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -16
   DEFINE FONT oBold  NAME 'Tahoma' SIZE 0, -14 BOLD

   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL


   @ 21 ,3 SAY oSay1 Prompt "Search " ;
                FONT oBold SIZE 120,20 PIXEL OF oDlg  TRANSPARENT


   @ 20,60 GET oGet VAR cSeek SIZE 200,20 PIXEL OF oDlg ;
             BITMAP "ELIMINA" ACTION (cSeek    := Space( 100 ),;
             oBrw:Seek( "" ),oBrw:refresh(),oGet:refresh())
             oGet:lBtnTransparent :=.t.

 @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oCust ;
      AUTOCOLS AUTOSORT CELL LINES NOBORDER

   WITH OBJECT oBrw

      :lIncrFilter      := .t.
     
      :oSeek   := oGet
       :CreateFromCode()


   END

  @ 20 ,  265 Say oSay2 Prompt  "in"  ;
               FONT oBold SIZE  55,   20 PIXEL   OF oDlg



      @ 20, 280  COMBOBOX oBrw:oSortCbx VAR oBrw:cSortOrder;
        SIZE 200,400 PIXEL OF oDlg HEIGHTGET 20 STYLE CBS_DROPDOWN


   ACTIVATE DIALOG oDlg CENTERED

return nil


CLASS TXData from TData
   DATA cPath init cFilePath(GetModuleFileName( GetInstance() ))
ENDCLASS

// Inherit from this to get autoincrementing primary-keys
CLASS TXAuto from TAutoincrement
      DATA cPath init cFilePath(GetModuleFileName( GetInstance() ))
ENDCLASS



CLASS TCust from TXAuto
   METHOD New()
ENDCLASS

METHOD New( lShared ) CLASS  TCust
   Default lShared := .t.
   ::super:New(,"Customer" ,, lShared)
   if ::use()
      ::setOrder(1)
      ::gotop()
   endif
RETURN Self


CLASS TOneCust from TRecord
  Method New()
ENDCLASS

Method New( oTable )  CLASS TOneCust
   ::super:New( oTable )
   Return self
 



Please can you try with tdata ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: james

Postby karinha » Sat Dec 11, 2021 8:42 pm

Yo haria asi: +-.

Code: Select all  Expand view

// SAMPLES\SILDATAB.PRG

#Include "Fivewin.ch"

ANNOUNCE RDDSYS // IDEM: ANNOUNCE FPTCDX
REQUEST OrdKeyNo, OrdKeyCount, OrdCreate, OrdKeyGoto // Para ListBox
REQUEST DBFCDX, DBFFPT

FUNCTION Main()

   LOCAL oDlg, oGet, oBrw, oFont, oBold, oCust, DbCust, oSay1, oSay2
   LOCAL cSeek := Space( 100 )

   RDDSETDEFAULT("DBFCDX")

   /*
   oCust:=TDatabase():Open( , "customer", "DBFCDX", .T. )
   oCust:setorder(1)
   oCust:Gotop()
   */


   IF NetUse( "CUSTOMER", .T. )

      OrdListAdd( "CUSTOMER", "FIRST", "LAST", "STREET" )

      OrdDescend( ,,.F. )

      DATABASE DbCust

      DbCust:Gotop()
      DbCust:Load()
      DbCust:SetBuffer( .T. )

   ELSE

      MsgStop( "Banco de Dados dos CLIENTES Bloqueado", "Cuidado!" )

      RETURN NIL

   ENDIF

   FW_CdxCreate()

   DbSelectArea( ( DbCust:cAlias ) )
   DbCust:SetOrder( 1 )
   DbGoTop()

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -16
   DEFINE FONT oBold NAME 'Tahoma' SIZE 0, -14 BOLD

   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL

   @ 21 ,3 SAY oSay1 Prompt "Search " ;
      FONT oBold SIZE 120,20 PIXEL OF oDlg  TRANSPARENT

   @ 20,60 GET oGet VAR cSeek SIZE 200,20 PIXEL OF oDlg ;
      BITMAP "ELIMINA" ACTION (cSeek    := Space( 100 ),;
      oBrw:Seek( "" ),oBrw:refresh(),oGet:refresh())
      oGet:lBtnTransparent :=.t.

   @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oCust ;
      AUTOCOLS AUTOSORT CELL LINES NOBORDER

   WITH OBJECT oBrw

      :lIncrFilter      := .t.
      :oSeek   := oGet
      :CreateFromCode()

   END

   @ 20 ,  265 Say oSay2 Prompt  "in"  ;
      FONT oBold SIZE  55,   20 PIXEL   OF oDlg

   // cSortOrder ??
   // @ 20, 280  COMBOBOX oBrw:oSortCbx VAR oBrw:cSortOrder;
   //     SIZE 200, 400 PIXEL OF oDlg HEIGHTGET 20 STYLE CBS_DROPDOWN


   ACTIVATE DIALOG oDlg CENTERED

RETURN NIL
// OPEN FILES
FUNCTION NetUse( cDbf, lShared )

   LOCAL cAlias := cFileName( cDbf )
   LOCAL bAlias := cFileName( cDbf )

   If cDbf = NIL .OR. !File( cDbf + ".DBF" )

      MsgStop( "NOME DO ARQUIVO INCORRETO" + CRLF + CRLF + ;
               "NÃO ACHEI BANCO DE DADOS." + CRLF + CRLF + ;
               cDbf + ".DBF", "ERRO FATAL!!" )

      RETURN( .F. )

   ENDIF

   IIf( lShared = NIL, lShared := .F., lShared )

   IF lShared = .T.

      USE "C:\MARC\"+(cDbf) ALIAS ( cAlias ) VIA "DBFCDX" SHARED NEW

   ELSE

      USE "
C:\MARC\"+(cDbf) ALIAS ( cAlias ) VIA "DBFCDX" EXCLUSIVE NEW

   ENDIF

   IF .NOT. NetErr()

      RETURN( .T. )

   ENDIF

   MsgStop( "
IMPOSSIVEL ABRIR BANCO DE DADOS: " + cAlias + CRLF + ;
            OemToAnsi( "
BLOQUEADO POR OUTRO USUµRIO." ),          ;
            "
ERRO FATAL DE REDE! FECHAR BANCO DE DADOS." )

RETURN( .F. )

// FIN END


Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: james

Postby Silvio.Falconi » Sun Dec 12, 2021 10:57 am

karinha wrote:Yo haria asi: +-.

Code: Select all  Expand view

// SAMPLES\SILDATAB.PRG

#Include "Fivewin.ch"

ANNOUNCE RDDSYS // IDEM: ANNOUNCE FPTCDX
REQUEST OrdKeyNo, OrdKeyCount, OrdCreate, OrdKeyGoto // Para ListBox
REQUEST DBFCDX, DBFFPT

FUNCTION Main()

   LOCAL oDlg, oGet, oBrw, oFont, oBold, oCust, DbCust, oSay1, oSay2
   LOCAL cSeek := Space( 100 )

   RDDSETDEFAULT("DBFCDX")

   /*
   oCust:=TDatabase():Open( , "customer", "DBFCDX", .T. )
   oCust:setorder(1)
   oCust:Gotop()
   */


   IF NetUse( "CUSTOMER", .T. )

      OrdListAdd( "CUSTOMER", "FIRST", "LAST", "STREET" )

      OrdDescend( ,,.F. )

      DATABASE DbCust

      DbCust:Gotop()
      DbCust:Load()
      DbCust:SetBuffer( .T. )

   ELSE

      MsgStop( "Banco de Dados dos CLIENTES Bloqueado", "Cuidado!" )

      RETURN NIL

   ENDIF

   FW_CdxCreate()

   DbSelectArea( ( DbCust:cAlias ) )
   DbCust:SetOrder( 1 )
   DbGoTop()

   DEFINE FONT oFont NAME 'Tahoma' SIZE 0, -16
   DEFINE FONT oBold NAME 'Tahoma' SIZE 0, -14 BOLD

   DEFINE DIALOG oDlg SIZE 500,500 PIXEL TRUEPIXEL

   @ 21 ,3 SAY oSay1 Prompt "Search " ;
      FONT oBold SIZE 120,20 PIXEL OF oDlg  TRANSPARENT

   @ 20,60 GET oGet VAR cSeek SIZE 200,20 PIXEL OF oDlg ;
      BITMAP "ELIMINA" ACTION (cSeek    := Space( 100 ),;
      oBrw:Seek( "" ),oBrw:refresh(),oGet:refresh())
      oGet:lBtnTransparent :=.t.

   @ 60,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oCust ;
      AUTOCOLS AUTOSORT CELL LINES NOBORDER

   WITH OBJECT oBrw

      :lIncrFilter      := .t.
      :oSeek   := oGet
      :CreateFromCode()

   END

   @ 20 ,  265 Say oSay2 Prompt  "in"  ;
      FONT oBold SIZE  55,   20 PIXEL   OF oDlg

   // cSortOrder ??
   // @ 20, 280  COMBOBOX oBrw:oSortCbx VAR oBrw:cSortOrder;
   //     SIZE 200, 400 PIXEL OF oDlg HEIGHTGET 20 STYLE CBS_DROPDOWN


   ACTIVATE DIALOG oDlg CENTERED

RETURN NIL
// OPEN FILES
FUNCTION NetUse( cDbf, lShared )

   LOCAL cAlias := cFileName( cDbf )
   LOCAL bAlias := cFileName( cDbf )

   If cDbf = NIL .OR. !File( cDbf + ".DBF" )

      MsgStop( "NOME DO ARQUIVO INCORRETO" + CRLF + CRLF + ;
               "NÃO ACHEI BANCO DE DADOS." + CRLF + CRLF + ;
               cDbf + ".DBF", "ERRO FATAL!!" )

      RETURN( .F. )

   ENDIF

   IIf( lShared = NIL, lShared := .F., lShared )

   IF lShared = .T.

      USE "C:\MARC\"+(cDbf) ALIAS ( cAlias ) VIA "DBFCDX" SHARED NEW

   ELSE

      USE "
C:\MARC\"+(cDbf) ALIAS ( cAlias ) VIA "DBFCDX" EXCLUSIVE NEW

   ENDIF

   IF .NOT. NetErr()

      RETURN( .T. )

   ENDIF

   MsgStop( "
IMPOSSIVEL ABRIR BANCO DE DADOS: " + cAlias + CRLF + ;
            OemToAnsi( "
BLOQUEADO POR OUTRO USUµRIO." ),          ;
            "
ERRO FATAL DE REDE! FECHAR BANCO DE DADOS." )

RETURN( .F. )

// FIN END


Regards.


Please Karinha,
For some time now, dear sir, you have been writing messages even if you have not been asked for anything, and even with other topics, if you read my post carefully, I was asking for a specific thing in particular

1) I not have Netuse
2) I made a test for dbf, tdatabase and tdata
3) I asked to try the test of Tdata, do you have the classs Tdata of James Bott ?

you have remmed these lines

// cSortOrder ??
// @ 20, 280 COMBOBOX oBrw:oSortCbx VAR oBrw:cSortOrder;
// SIZE 200, 400 PIXEL OF oDlg HEIGHTGET 20 STYLE CBS_DROPDOWN

I see that you have not understood my problem, my problem is in that combobox please see fwh\samples\xbsortcb.prg to see the original Nages sample
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: james

Postby karinha » Sun Dec 12, 2021 12:39 pm

Sorry, my version doesn't have: fwh\samples\xbsortcb.prg

Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7794
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: james

Postby Silvio.Falconi » Mon Dec 13, 2021 7:32 am

When I created the application for the beach, in December 2020
james corrected the definitions for opening the archives by creating a class called Tincremental which was only used to add a counter.

In these definitions james omits the "DBFCDX" driver because perhaps with Tdata it was not needed or he takes them automatically.

Code: Select all  Expand view

CLASS TTCategorie from TXAuto
   METHOD New()
ENDCLASS

METHOD New( lShared ) CLASS TTCategorie
   Default lShared := .t.
   ::super:New(,::cPath + "Categorie" ,, lShared)
   if ::use()
      ::setOrder(1)
      ::gotop()
   endif
RETURN Self
 


Just yesterday reviewing the code I realized that the definition created by James calls the New method of Tdatabase which,

Code: Select all  Expand view
::super:New(,::cPath + "Categorie" ,, lShared)


however, wants the definition of the "DBFCDX" driver,

Code: Select all  Expand view
::super:New(,::cPath + "Categorie" ,"DBFCDX", lShared


in fact adding this parameter then the test works wonders.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm

Re: james

Postby James Bott » Sat Dec 18, 2021 8:27 pm

You don't ever want to add the database driver in the database class's New() method--you should define the default driver at the beginning of the program. This way all routines in the app use the same driver and if you ever want to change the driver you only have to change it in one place.

The only exception to this rule (that I can think of) is if you needed to use a file and index from a different app that is using a different driver. Then you still use a default driver for the current app but specify a different driver for a special routine. This would extremely rare I think--I have never needed to do this.
FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: james

Postby Silvio.Falconi » Sun Dec 19, 2021 11:19 am

James Bott wrote:You don't ever want to add the database driver in the database class's New() method--you should define the default driver at the beginning of the program. This way all routines in the app use the same driver and if you ever want to change the driver you only have to change it in one place.

The only exception to this rule (that I can think of) is if you needed to use a file and index from a different app that is using a different driver. Then you still use a default driver for the current app but specify a different driver for a special routine. This would extremely rare I think--I have never needed to do this.



James,
at int I insert these lines in all my applications

Code: Select all  Expand view
request dbfcdx
request dbffpt

request hb_lang_it
request hb_codepage_itwin

FUNCTION Main()

....

RddSetDefault( "DBFCDX" )
   HB_LANGSELECT( "IT" )
   HB_SETCODEPAGE( "ITWIN" )
   SetHandleCount( 100 )
   FWNumFormat( "E", .t. )



If I use tdatabase I not have error
If I use tdata without add the database driver in the tdata class's New() method I have error

My set tdata ( sample Utenti.dbf )
Code: Select all  Expand view

CLASS TXData from TData
     DATA cDbfPath init oApp:cDbfPath
     DATA cExePath init oApp:cExePath
ENDCLASS

CLASS TUtenti from TXData
   METHOD New()
ENDCLASS

METHOD New( lShared ) CLASS TUtenti
   Default lShared := .t.
   ::super:New(,::cExePath + "Utenti" ,, lShared)
   if ::use()
      ::setOrder(1)
      ::gotop()
   endif
RETURN Self


the error is " I not see any tag on the combobox"
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7033
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 56 guests