Board index » delphi » oncalc on a table...stack overflow...how to overcome problem

oncalc on a table...stack overflow...how to overcome problem

I have a producttable being copied (batchmove) to suggesttable....on the
oncalc of the suggesttable I calculated an extended cost.....for the product
being copied....

Once I have the suggested table showing on a grid......I can add, remove or
modify the suggestted order....but I have recently been playing with
this.....and added a delete item key.....a simple suggesttable.delete....I
press this key maybe....20 times......and I get a stack overflow.....

I know its related to the oncalc on the table itself....? but how do I work
around this? any suggestions appreciated...

Thanks

Alex

 

Re:oncalc on a table...stack overflow...how to overcome problem


It could be your code (whci we can't see) or maybe
you just need an Application.ProcessMessages
to give Windows a chance to catch up.

Also, if you are doing a batch process, you might
need or want to put in a flag not to bother doing on
oncalc until the batch is done.  The batch will run faster
then.

Quote
Alex E <a...@superiway.net> wrote in message

news:7tdd5f$d1m5@forums.borland.com...
Quote
> I have a producttable being copied (batchmove) to suggesttable....on the
> oncalc of the suggesttable I calculated an extended cost.....for the
product
> being copied....

> Once I have the suggested table showing on a grid......I can add, remove
or
> modify the suggestted order....but I have recently been playing with
> this.....and added a delete item key.....a simple suggesttable.delete....I
> press this key maybe....20 times......and I get a stack overflow.....

> I know its related to the oncalc on the table itself....? but how do I
work
> around this? any suggestions appreciated...

> Thanks

> Alex

Re:oncalc on a table...stack overflow...how to overcome problem


You cannot insert records, delete records or change the value of
non-calculated fields in a table from its own OnCalcFields event handler.
Doing so causes another OnCalcFields event thus the recursion.

Bill

--

Bill Todd - TeamB
(TeamB cannot respond to questions received via email)

Other Threads