TimStone wrote:He has been very busy.
Sent from my iPhone using Tapatalk
#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
#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
#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
// 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
karinha wrote:Yo haria asi: +-.
- Code: Select all Expand view RUN
// 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.
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
::super:New(,::cPath + "Categorie" ,, lShared)
::super:New(,::cPath + "Categorie" ,"DBFCDX", lShared
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.
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. )
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
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 73 guests