May I have an sample for TProgress for Index
May I have an sample for TProgress for Index
Dear All,
I've used TMeter for index progress bar and it works in 16bits but I convert to 32bits now. I don't work properly. May I have an example for Index Progress Bar?
Thanks in advance,
Dutch
I've used TMeter for index progress bar and it works in 16bits but I convert to 32bits now. I don't work properly. May I have an example for Index Progress Bar?
Thanks in advance,
Dutch
Sorry, I don't have an example for an index progress bar.
But it looks strange to me that TMeter isn't working in 32-bit.
I converted a progress bar, using TMeter, from 16-bits to 32-bits too and it is working fine here.
But it looks strange to me that TMeter isn't working in 32-bit.
I converted a progress bar, using TMeter, from 16-bits to 32-bits too and it is working fine here.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 21.01 - Harbour 3.2.0 (October 2020) - xHarbour Builder (January 2020) - Bcc7
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
Re: May I have an sample for TProgress for Index
This is a working sample:
EMG
Code: Select all
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oMtr
LOCAL nPos
USE TEST
DEFINE DIALOG oDlg
@ 1, 1 METER oMtr VAR nPos TOTAL LASTREC();
SIZE 100, 20
@ 3, 1 BUTTON "Start";
ACTION STARTINDEX( oMtr )
ACTIVATE DIALOG oDlg;
CENTER
CLOSE
RETURN NIL
STATIC FUNCTION STARTINDEX( oMtr )
INDEX ON FIELD -> last + FIELD -> first TO MTRTEST EVAL ( oMtr:Set( RECNO() ), oMtr:Refresh(), .T. )
MSGINFO( "Done!" )
RETURN NIL
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Dutch, to show progress meter while indexing via RDDADS, use something similar to the following:
Code: Select all
FUNCtion CreateIndex( aNtxKey )
LOCAL nCnt, lUnique
#define ADS_ABORT .t.
#define ADS_CONTINUE .f.
oNtxMeter:nTotal:=100 //LastRec()
ADSRegCallBack({|nPercent| progress(nPercent,cNtxName)})
FOR nCnt := 1 TO LEN( aNtxKey )
cNtxKey := aNtxKey[ nCnt, 1 ]
cNtxName := aNtxKey[ nCnt, 2 ]
cNtxFor := ""
if len(aNtxKey[nCnt]) > 3
cNtxFor := aNtxKey[ nCnt, 4 ]
endif
lUnique := if( LEN( aNtxKey[ nCnt ] ) > 2, aNtxKey[ nCnt, 3 ], FALSE )
oSayText:bGet := { || "Re-building ... " + UPPER( cNtxName ) + ".NTX" }
oSayText:Refresh()
oNtxMeter:Set(0)
oNtxMeter:display()
CursorWait()
IF lUnique
/*
if lExclDel
INDEX ON &( cNtxKey ) TO ( cNtxName ) UNIQUE for !deleted() ;
EVAL ( oNtxMeter:Set( Recno() ), SysRefresh(), .T. )
else
*/
INDEX ON &( cNtxKey ) TO ( cNtxName ) UNIQUE
//EVAL ( oNtxMeter:Set( Recno() ), SysRefresh(), .T. )
// ADS doesn't recognize eval..every
*endif
ELSE
if empty(cNtxFor)
INDEX ON &( cNtxKey ) TO ( cNtxName )
//EVAL ( oNtxMeter:Set( Recno() ), SysRefresh(), .T. )
else
INDEX ON &( cNtxKey ) TO ( cNtxName ) for &(cNtxFor)
//EVAL ( oNtxMeter:Set( Recno() ), SysRefresh(), .T. )
endif
ENDIF
NEXT
ADSClrCallBack()
RETURN (Nil)
//-------------------------------------------------------------------------
static function progress(nPercent,CurrentNtx)
static cNtx
if cNtx==nil
cNtx := ""
endif
if empty(cNtx)
cNtx := currentNtx
elseif cNtx != CurrentNtx
cNtx := currentNtx
oNtxMeter:Set(100)
oNtxMeter:display()
endif
oNtxMeter:Set( nPercent )
oNtxMeter:display()
return ADS_CONTINUE
- kokookao2007
- Posts: 59
- Joined: Thu May 17, 2007 8:27 am
That's the way it works !!!!!
Why ?.... well, the explanation is very simple, ADS server does the indexing, not your program, this means that INDEX ON just send the indexing order to the server and then the server takes care of performing the operation, so your program will never know the status of the indexing progress, since you don't have a way of "asking" the ADS server the percentage of advance.
AdsClrCallBack() does a "call back" to the server, this means that the server will give your application an "status" of the currently running process.
The "call back" is only available for indexing, not for running queries (ADS does SQL queries and they are damn fast), or setting AOF() or Scopes.
Why ?.... well, the explanation is very simple, ADS server does the indexing, not your program, this means that INDEX ON just send the indexing order to the server and then the server takes care of performing the operation, so your program will never know the status of the indexing progress, since you don't have a way of "asking" the ADS server the percentage of advance.
AdsClrCallBack() does a "call back" to the server, this means that the server will give your application an "status" of the currently running process.
The "call back" is only available for indexing, not for running queries (ADS does SQL queries and they are damn fast), or setting AOF() or Scopes.
Saludos
R.F.
R.F.