Página 1 de 1

TDbfDataSet:AddTag() error

Publicado: Lun Jun 11, 2007 5:18 pm
por Gejza Horvath
Hi guys,
I have reported you a problem with progressbar in AddTag method of the TdbfDataSet class 3
weeks ago. Your response was:
"This seems to work correctly"
Yes, it seems to work ok, but in some cases the progressbar is not filled to 100%, after
the method is finished. Try please this method with attached file, which has 240 records.
Looking to the source I found a code, which is wrong in AddTag() method:
IF oPgBar != Nil
nCount := ::RecCount()
WITH OBJECT oPgBar
:nMin := 0
:nValue := 0
:nStep := 1
IF nCount > 100
nStep := Round( ( nCount / 100) + 0.5, 0 )
:nMax := 100
ELSE
nStep := 1
:nMax := nCount
ENDIF
END WITH
bEval := {|| oPgBar:nValue += 1, .T. } //!!!! Here is the problem !!!!
ENDIF
After calculating the nStep, you always use 1. In my case:
nCount := 240
nMax := 100
nStep := 3
but the codeblock is evaluated after every 100 records, only twice.
I think, the right code should be:
bEval := {|| oPgBar:nValue += nStep, .T. }
Please check this issue
Gejza Horvath


Attached files TSTAT.DBF (16.6 KB)Â

TDbfDataSet:AddTag() error

Publicado: Lun Jun 11, 2007 7:44 pm
por ignacio
Gejza,
You are completely right. Thank you for your feedback.
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=466d6817@ozsrv2.ozlan.local...]466d6817@ozsrv2.ozlan.local...[/email]
> Hi guys,
>
> I have reported you a problem with progressbar in AddTag method of the
> TdbfDataSet class 3 weeks ago. Your response was:
>
> "This seems to work correctly"
>
> Yes, it seems to work ok, but in some cases the progressbar is not filled
> to 100%, after the method is finished. Try please this method with
> attached file, which has 240 records.
>
> Looking to the source I found a code, which is wrong in AddTag() method:
>
> IF oPgBar != Nil
> nCount := ::RecCount()
> WITH OBJECT oPgBar
> :nMin := 0
> :nValue := 0
> :nStep := 1
> IF nCount > 100
> nStep := Round( ( nCount / 100) + 0.5, 0 )
> :nMax := 100
> ELSE
> nStep := 1
> :nMax := nCount
> ENDIF
> END WITH
> bEval := {|| oPgBar:nValue += 1, .T. } //!!!! Here is the problem
> !!!!
> ENDIF
>
> After calculating the nStep, you always use 1. In my case:
> nCount := 240
> nMax := 100
> nStep := 3
>
> but the codeblock is evaluated after every 100 records, only twice.
>
> I think, the right code should be:
>
> bEval := {|| oPgBar:nValue += nStep, .T. }
>
>
> Please check this issue
>
> Gejza Horvath
>
>

TDbfDataSet:AddTag() error

Publicado: Lun Jun 11, 2007 8:17 pm
por Gejza Horvath
Ignazio,
I have tried to rewrite the AddTag method, but the linker miss the COMPILAR() function.
Can you help me ?
Gejza

TDbfDataSet:AddTag() error

Publicado: Lun Jun 11, 2007 8:40 pm
por ignacio
Gezja,
Really strange. Is defined on the top of the source file:
#define COMPILAR(cExpr) &("{||" + cExpr + "}")
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=466d920a@ozsrv2.ozlan.local...]466d920a@ozsrv2.ozlan.local...[/email]
> Ignazio,
>
> I have tried to rewrite the AddTag method, but the linker miss the
> COMPILAR() function. Can you help me ?
>
> Gejza
>
>

TDbfDataSet:AddTag() error

Publicado: Mar Jun 12, 2007 5:04 pm
por Gejza Horvath
Ignacio,
don't forget to call ProcessMessages() function before Return statement in this method. I
have a reindex routine displaying the actually indexed filename, and using the origin
code, the TLabel object is not refreshed. Calling this function all works fine.
Gejza Horvath

TDbfDataSet:AddTag() error

Publicado: Mar Jun 12, 2007 6:00 pm
por ignacio
Gejza,
Automatic call to ProcessMessages() can provoke very annoying efects, for
example, it may let you push a button on a dialog during the reindex
process. Its better that you call the function yourself on the
TProgressBar:OnChange event
Regards,
--
Ignacio Ortiz de Zúñiga
http://www.xailer.com
"Gejza Horvath" <_hsoftkn@nextra.sk> escribió en el mensaje
news:[email=466eb656@ozsrv2.ozlan.local...]466eb656@ozsrv2.ozlan.local...[/email]
> Ignacio,
>
> don't forget to call ProcessMessages() function before Return statement in
> this method. I have a reindex routine displaying the actually indexed
> filename, and using the origin code, the TLabel object is not refreshed.
> Calling this function all works fine.
>
>
> Gejza Horvath
>