Page 1 of 3
Index progress bar
Posted: Sun Feb 28, 2016 12:19 am
by trmpluym
In the good old Clipper days i used an progress bar function (NtxBar) for indexing (0% to 100%). Here a Clipper code snippet:
INDEX ON &cNdxExpr TAG (cNdxName) UNIQUE FOR !Deleted() TO (cDbfName) eval NtxBar(aStat) every (aStat[4])
Now i like to accomplisch the same in HMG, but I'm stuck.
The goal is to use a modal window in the main window showing a 0% to 100% status bar during the indexing process.
See in the attachment my coding result until now. Two problems:
1. The indicator is not showing the right lenght. When the counter is 100% the progressbar is at 95%. The progress bar seems to delay 5% but the value (nX) is the same ! Strange, why ?
2. How to implement this progressbar in an eval() function (can be used in index on ... )
Or is there a simpler \ smarter way to create a progress bar in a modal window ? Somebody else has got a good indexing progress bar example ?
Re: Index progress bar
Posted: Sun Feb 28, 2016 9:54 am
by serge_girard
Theo,
Your PRG seems OK to me. See att.
I will search for EVAL sample.
Serge
Re: Index progress bar
Posted: Sun Feb 28, 2016 10:00 am
by serge_girard
Theo,
Found this: (in my samples)
Code: Select all
...
nRecsDone := 0
FORM_CONTACT.Progress_1.Value := nRecsDone
USE Tipos ALIAS Tipos EXCLUSIVE
nLastRec := LastRec()
INDEX ON STR(Cod_Tipo, 3) TAG Cod_Tipo
INDEX ON HMG_Upper(Desc) TAG Desc
REINDEX EVAL {|| InProgress(nLastRec) } EVERY 10
....
Function InProgress(nLastRec)
nRecsDone := nRecsDone + 10
FORM_CONTACT.Progress_1.Value := ( nRecsDone/nLastRec ) * 100
hb_IdleSleep( 0.2 ) // When dbf is too big, pls cut off this
Return .T.
I haven't tested this myself
Serge
Re: Index progress bar
Posted: Sun Feb 28, 2016 10:52 am
by dragancesu
The progress bar is nice but unnecessary, in this case "L'art pour l'art"
I think it would be useful to show how the table is indexed
For example, there are 10 tables, 15 index, then to count from 1 to 15 and to show the progress bar and possibly write the name of the tables and indexes
Re: Index progress bar
Posted: Sun Feb 28, 2016 10:59 am
by serge_girard
Maybe true, maybe not.
Nature of the question was not aesthetical or arty but technical!
S
Re: Index progress bar
Posted: Sun Feb 28, 2016 11:22 am
by trmpluym
Hi Serge,
Serge wrote:"Your PRG seems OK to me. See att."
Thanks again for your help !
I tried both HMG 3.4.0 and 3.4.2 and both show me:

- ProgressBar.png (3.03 KiB) Viewed 12439 times
Strange because the nX value is the same. Do you use another compiler ?
Re: Index progress bar
Posted: Sun Feb 28, 2016 11:27 am
by trmpluym
dragancesu wrote:The progress bar is nice but unnecessary, in this case "L'art pour l'art"
indexes
For small indexes it is. But for large indexes it informs the user what is happening so the don't think the program is 'frozen'.
dragancesu wrote:
I think it would be useful to show how the table is indexed
For example, there are 10 tables, 15 index, then to count from 1 to 15 and to show the progress bar and possibly write the name of the tables and indexes
I like to see a progress bar per index. So for 10 tables with 15 indexes. I like to see 15 index progress indicators (one by one after eachother) processing from 0% to 100%. More clear ?
Re: Index progress bar
Posted: Sun Feb 28, 2016 11:33 am
by serge_girard
Theo,
I use HMG3.4.2 on W7 PC.
Serge
Re: Index progress bar
Posted: Sun Feb 28, 2016 11:37 am
by trmpluym
serge_girard wrote:Theo,
I use HMG3.4.2 on W7 PC.
Serge
Hmm, strange mine is also HMG3.4.2 on W7. I will send you my EXE in a PM. Gan you give it a try ?
Re: Index progress bar
Posted: Sun Feb 28, 2016 11:45 am
by serge_girard
Yes, I can!
S