Can I see a sample source code with a index with a progress ( meter)
thanks
Silvio wrote:Can I see a sample source code with a index with a progress ( meter)
#include "FwCe.ch"
REQUEST DBFCDX
//------------------------------------------------------------------------//
Function Main()
Local oWnd, oBtn[ 2 ], oMeter, nProg
USE ( CurDir() + "\Customer" ) EXCLUSIVE NEW VIA "DBFCDX"
DEFINE WINDOW oWnd TITLE "Indexing"
@ 20, 10 BUTTON oBtn[ 1 ] PROMPT "&Index" OF oWnd SIZE 60, 20 PIXEL ;
ACTION fIndex( oMeter )
@ 20, 80 BUTTON oBtn[ 2 ] PROMPT "&Exit" OF oWnd SIZE 40, 20 PIXEL ;
ACTION oWnd:End()
@ 50, 5 PROGRESS oMeter POS nProg OF oWnd SIZE 226, 20 PIXEL
ACTIVATE WINDOW oWnd
Return Nil
//------------------------------------------------------------------------//
Function fIndex( oMeter )
Local nVar, nStep, nTotal
Field Last, First
If File( "Customer.cdx" )
FErase( "Customer.cdx" )
EndIf
nTotal := RecCount()
nStep := Max( Int( nTotal * .02 ), 1 ) // update meter every 2% of progress is faster than every record
nVar := 0
oMeter:SetRange( 0, nTotal )
oMeter:SetPos( 0 )
Index On Last + First Tag ( "LASTFIRST" ) To Customer ;
Eval { || oMeter:SetPos( nVar += nStep ), SysRefresh(), .T. } Every nStep
oMeter:SetPos( nTotal )
Return Nil
Silvio wrote:it run but not create cdx file
#include "FwCe.ch"
REQUEST DBFCDX
//------------------------------------------------------------------------//
Function Main()
Local oWnd, oBtn[ 2 ], oMeter, nProg
DEFINE WINDOW oWnd TITLE "Indexing"
@ 20, 10 BUTTON oBtn[ 1 ] PROMPT "&Index" OF oWnd SIZE 60, 20 PIXEL ;
ACTION fIndex( oMeter )
@ 20, 80 BUTTON oBtn[ 2 ] PROMPT "&Exit" OF oWnd SIZE 40, 20 PIXEL ;
ACTION oWnd:End()
@ 50, 5 PROGRESS oMeter POS nProg OF oWnd SIZE 226, 20 PIXEL
ACTIVATE WINDOW oWnd
Return Nil
//------------------------------------------------------------------------//
Function fIndex( oMeter )
Local nVar, nStep, nTotal
Field Last, First
If File( CurDir() + "\Customer.cdx" )
FErase( CurDir() + "\Customer.cdx" )
EndIf
USE ( CurDir() + "\Customer" ) EXCLUSIVE NEW VIA "DBFCDX"
nTotal := RecCount()
nStep := Max( Int( nTotal * .02 ), 1 ) // update meter every 2% of progress is faster than every record
nVar := 0
oMeter:SetRange( 0, nTotal )
oMeter:SetPos( 0 )
Index On Last + First Tag ( "LASTFIRST" ) ;
Eval { || oMeter:SetPos( nVar += nStep ), SysRefresh(), .T. } Every nStep
oMeter:SetPos( nTotal )
Return Nil
#include "FwCe.ch"
REQUEST DBFCDX
/*
SAMPLE TEST FOR INDEX ARCHIVES WITH PROGRESS CONTROL OF AN APPLICATION
ON TEST THERE ARE 5 PROGRESS CONTROL
*/
static cPath
//------------------------------------------------------------------------//
Function Main()
Local oWnd, oBtn[ 2 ], oMeter, nProg
Local oMeter1 , oMeter2 , oMeter3 , oMeter4 , oMeter5
Local oMeter6 , oMeter7 , oMeter8, oMeter9 , oMeter10
Local lPack :=.F.
DEFINE WINDOW oWnd TITLE "Indexing"
HideKeyboard()
@ 10, 5 PROGRESS oMeter1 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 35, 5 PROGRESS oMeter2 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 60, 5 PROGRESS oMeter3 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 85, 5 PROGRESS oMeter4 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 110, 5 PROGRESS oMeter5 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 135, 5 PROGRESS oMeter6 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 160, 5 PROGRESS oMeter7 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 185, 5 PROGRESS oMeter8 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 210, 5 PROGRESS oMeter9 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 235, 5 PROGRESS oMeter10 POS nProg OF oWnd SIZE 226, 20 PIXEL
@ 250, 15 CHECKBOX lPack PROMPT "&Pack" OF oWnd SIZE 60, 15 PIXEL
@ 250, 95 BUTTON oBtn[ 1 ] PROMPT "&Index" OF oWnd SIZE 60, 20 PIXEL ;
ACTION fIndex( lPack,oMeter1 , oMeter2 , oMeter3 , oMeter4 , oMeter5, oMeter6 , oMeter7 , oMeter8, oMeter9 , oMeter10, oWnd )
@ 250, 180 BUTTON oBtn[ 2 ] PROMPT "&Exit" OF oWnd SIZE 40, 20 PIXEL ;
ACTION oWnd:End()
ACTIVATE WINDOW oWnd;
ON INIT DlgFullScreen( oWnd:hWnd )
Return Nil
//------------------------------------------------------------------------//
Function fIndex( lPack,oMeter1 , oMeter2 , oMeter3 , oMeter4 , oMeter5, oMeter6 , oMeter7 , oMeter8, oMeter9 , oMeter10, oWnd)
Local nVar, nStep, nTotal
/// ---- here I take the path on the control archive
IF NetUse( CurDir() +"\control",.F.)
cPath:=Alltrim(Control->Data)+"\"
dbCloseArea()
ENDIF
// clienti
IF NetUse( CurDir() +cPath+ "CLIENTI",.F.)
If File( CurDir() +cPath+ "clienti.cdx" )
FErase( CurDir() +cPath+ "clienti.cdx" )
EndIf
IF lPack = .T.
PACK
ENDIF
nTotal := RecCount()
nStep := Max( Int( nTotal * .02 ), 1 )
nVar := 0
oMeter1:SetRange( 0, nTotal )
oMeter1:SetPos( 0 )
@ 150, 5 say "Sto indicizzando l'archivio dei clienti" OF oWnd SIZE 220, 20 PIXEL
* Index On Field->Last + Field->First Tag LASTFIRST To Customer ;
* Eval { || oMeter1:SetPos( nVar += nStep ), SysRefresh(), .T. } Every nStep
Index On Field->Numcli Tag CLIXCVE TO ( CurDir() +cPath+ "CLIENTI" )
oMeter1:SetPos(15)
Index On Field->RAZSOC Tag CLIXDES TO ( CurDir() +cPath+ "CLIENTI" )
oMeter1:SetPos(30)
Index On DTOS(Field->ULTVEN) TAG CLIXFEC TO ( CurDir() +cPath+ "CLIENTI" )
oMeter1:SetPos(45)
Index ON Field->SALACT TAG CLIXSAL TO ( CurDir() +cPath+ "CLIENTI" )
oMeter1:SetPos(60)
INDEX ON Field->VENNET TAG CLIXVEN TO ( CurDir() +cPath+ "CLIENTI" )
oMeter1:SetPos(75)
INDEX ON Field->RUTA+ Field->RAZSOC TAG CLIXRUT TO ( CurDir() +cPath+ "CLIENTI" )
oMeter1:SetPos(100)
* oMeter1:SetPos( nTotal )
dbCloseArea()
ENDIF
Return Nil
// functions for the sample test
FUNCTION NetUse( cDbf, lShared )
LOCAL cAlias := cFileName( cDbf )
If cDbf = NIL .OR. !File( cDbf + ".DBF" )
MsgStop( "NOME ERRATO" + CRLF + "o" + CRLF + ;
"NON POSSO TROVARE LA BASE DEI DATI." + CRLF + cDbf + ".DBF", "ERROR" )
RETURN( .F. )
ENDIF
IIf( lShared = NIL, lShared := .F., lShared )
IF lShared = .T.
USE (cDbf) ALIAS (cAlias := GetNewAlias( cAlias )) VIA "DBFCDX" SHARED NEW
ELSE
USE (cDbf) ALIAS (cAlias) VIA "DBFCDX" EXCLUSIVE NEW
ENDIF
IF !NetErr()
RETURN( .T. )
ENDIF
MsgStop( "IMPOSIBLE APRIRE IL FILE " + cAlias + CRLF + ;
OemToAnsi( "bloccato da un altro utente." ), ;
"ERRORE" )
RETURN( .F. )
FUNCTION GetNewAlias( cAlias )
STATIC n := 0
RETURN cAlias + StrZero( ++n, 4 )
#pragma BEGINDUMP
#include <hbapi.h>
#include <windows.h>
#include <aygshell.h>
HB_FUNC( DLGFULLSCREEN )
{
SHINITDLGINFO shidi;
memset( &shidi, 0, sizeof( SHINITDLGINFO ) );
shidi.dwMask = SHIDIM_FLAGS;
shidi.hDlg = ( HWND ) hb_parnl( 1 );
shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN;
SHInitDialog( &shidi );
}
#pragma ENDDUMP
Return to FiveWin for Pocket PC
Users browsing this forum: No registered users and 9 guests