Page 1 of 3
Show indexing progress
Posted: Sun Sep 12, 2010 5:30 pm
by cocoking
Please find time to examine my code.
With the codes below, EditBox is shown after Activate Window, thus index progress is not real-time. With too many files and too many records, display will be blank for a long time before EditBox is shown.
My intention is to show the editbox and update display after every file is indexed. How do I do it?
function Reindex()
DECLARE WINDOW MainForm
DEFINE WINDOW fmReindex ;
AT 10, 10 ;
WIDTH 336 ;
HEIGHT 310 ;
TITLE "Reindexing Files" ;
MODAL
@ 10, 10 EDITBOX ebRein ;
PARENT fmReindex ;
WIDTH 300 ;
HEIGHT 300 ;
VALUE "Reindexing files..." + CRLF ;
READONLY
ON KEY ESCAPE OF fmReindex ACTION fmReindex.Release
END WINDOW
// indexing codes are here
use file1
index on field1 to file1
fmReindex.ebRein.Value := fmReindex.ebRein.Value + "File1..." + CRLF
use file2
index on field2 to file2
fmReindex.ebRein.Value := fmReindex.ebRein.Value + "File2..." + CRLF
// other files are indexed here...
CENTER WINDOW fmReindex
ACTIVATE WINDOW fmReindex
return NIL
I thought of transferring all indexing codes below the Activate Window command and adding a .show, such as this:
...
CENTER WINDOW fmReindex
ACTIVATE WINDOW fmReindex
use file1
index on field1 to file1
fmReindex.ebRein.Value := fmReindex.ebRein.Value + "File1..." + CRLF
fmReindex.ebRein.show
...
but I get an error: Control: ebRein of fmReindex not defined. Program terminated.
Any ideas?
Re: Show indexing progress
Posted: Sun Sep 12, 2010 5:37 pm
by Rathinagiri
Please try this:
Code: Select all
function Reindex()
DECLARE WINDOW MainForm
DEFINE WINDOW fmReindex ;
AT 10, 10 ;
WIDTH 336 ;
HEIGHT 310 ;
TITLE "Reindexing Files" ;
MODAL On INIT indexfiles()
@ 10, 10 EDITBOX ebRein ;
PARENT fmReindex ;
WIDTH 300 ;
HEIGHT 300 ;
VALUE "Reindexing files..." + CRLF ;
READONLY
ON KEY ESCAPE OF fmReindex ACTION fmReindex.Release
END WINDOW
CENTER WINDOW fmReindex
ACTIVATE WINDOW fmReindex
return NIL
Function indexfiles
// indexing codes are here
use file1
index on field1 to file1
fmReindex.ebRein.Value := fmReindex.ebRein.Value + "File1..." + CRLF
use file2
index on field2 to file2
fmReindex.ebRein.Value := fmReindex.ebRein.Value + "File2..." + CRLF
// other files are indexed here...
Return Nil
Re: Show indexing progress
Posted: Mon Sep 13, 2010 12:18 pm
by cocoking
Rathi, thank you for your suggestion. Unfortunately it did not work as intended. Using Trace Debug, I found that the editbox's contents ("File1", "File2"...) were written only after all files were indexed (after finishing the Indexfiles function).
I tried to add
fmReindex.ebRein.show after each file, no difference.
I tried to add
fmReindex.ebRein.refresh after each file, then I get an Argument error: & on the first file indexed (File1):
Error BASE/1065 Argument error: &
Called from _DATAEDITBOXREFRESH(237)
Called from _REFRESH(3686)
Called from _DOMETHOD(7446)
Called from REINSYSFILES(176)
...
Please note that ReinSysFiles(176) is the
fmReindex.ebRein.refresh command.
Looking at the display, however, the ebRein window showed "File1..."
Was it updating ebRein (as intended) when it had an Argument error?
Please help. Or would you prefer/recommend another way of showing the indexing progress?
TYVM
Re: Show indexing progress
Posted: Mon Sep 13, 2010 1:40 pm
by mrduck
cocoking wrote:Rathi, thank you for your suggestion. Unfortunately it did not work as intended. Using Trace Debug, I found that the editbox's contents ("File1", "File2"...) were written only after all files were indexed (after finishing the Indexfiles function).
You must give windows the time to process your request...
Try adding
DO EVENTS
after the
fmReindex.ebRein.value :=
Re: Show indexing progress
Posted: Mon Sep 13, 2010 3:59 pm
by esgici
Hi Cocoking
Please look at this :
download/file.php?id=1439
Regards
--
Esgici
Re: Show indexing progress
Posted: Mon Sep 13, 2010 4:06 pm
by Rathinagiri
Thanks for the link Esgici.

Re: Show indexing progress
Posted: Tue Sep 14, 2010 1:38 am
by cocoking
Thank you for joining, esgici, however, the attachment does not exist anymore.
Re: Show indexing progress
Posted: Tue Sep 14, 2010 11:38 am
by esgici
Hi Cocoking,
I re-downloaded and re-attached here.
The .rar file shown in the "Portal Index" page of forum.
I hope that it will help you.
Regards
--
Esgici
- IndxPrgss.rar
- Solution for Index Progress problem sent by Cocoking
- (2.89 KiB) Downloaded 322 times
Re: Show indexing progress
Posted: Wed Sep 15, 2010 9:13 am
by cocoking
Thank you for the help. Unfortunately, I did not get what I intended to do (similar to progress bar):
Several files are automatically indexed; as files are indexed, editbox should update as follows:
as 1st file is indexed, editbox should show --> File1
as 2nd file is indexed, editbox should show --> File1, File2
as 3rd file is indexed, editbox should show --> File1, File2, File3
as 4th file is indexed, editbox should show --> File1, File2, File3, File4
...
as nth file is indexed, editbox should show --> File1, File2, File3, File4... FileN
What happens is, the indexing is already finished when the editbox is updated. If several big files are involved, screen would show no activity for a long time (waiting for the indexing to be finished), before the editbox is updated. It is not like a progress bar at all.
Tracing thru the programs (using altd() function), I discovered that the windows/objects display are updated only when the end of the event loop is reached (the ACTIVATE WINDOW command).
Please teach me how to force the screen update/refresh (programatically, without user intervention) before the ACTIVATE WINDOW command, if at all possible.
TYVM
Re: Show indexing progress
Posted: Wed Sep 15, 2010 9:23 am
by mrduck
cocoking wrote:
Please teach me how to force the screen update/refresh (programatically, without user intervention) before the ACTIVATE WINDOW command, if at all possible.
I don't think it is possible since the window is not activated
You have two ways:
1) create the first MODAL window with one editbox/progressbar and in its ON INIT procedure do the indexing; as last line force window closing; then open the window you need to work in
2) create the window as you do now; you need to run the indexing in the ON INIT procedure if you want to visually change the editbox value... and you should call "do events" if you want that windows updates the display