Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 5 of 5 total
Thread Editing a grid column, how to force a repaint of the grid
Thu, Oct 25 2018 3:06 PMPermanent Link

erickengelke

Hi,

I have a TGrid backed by a TDataSet.  When the user forces a recalculation by pressing a TButton, we cycle through the TDataSet in EWB Javascript and produce correct values in various columns.

The code worked but was SLOW, then we added BeginControlUpdate and EndControlUpdate to speed up the processing.  Now the code is fast, but the current row does not update the screen image, even though it has the correct internal values in the TDataSet.  So the screen is not updated.

If the user clicks on a different row, EWB correctly updates that changed row from the previous step.  But obviously we want to change the data in real time.  I tried Grid1.ForceUpdate, but it doesn't help.

I've been pulling out my hair trying to find or remember how to end the edit mode and force an update, but I can't seem to find the answer.  Of course this happens at the 11th hour on a project.

I;m sure there's like one function I call, but I cannot find it.

Thanks in advance.
Erick
EWB Programming Books and Component Library
http://www.erickengelke.com
Thu, Oct 25 2018 3:58 PMPermanent Link

Walter Matte

Tactical Business Corporation

When you cycle through the TDataset are you doing and :

Edit; Save; Next;   

or just and

Edit; Next; (which will cause a Save except for the last row?

Walter

erickengelke wrote:

Hi,

I have a TGrid backed by a TDataSet.  When the user forces a recalculation by pressing a TButton, we cycle through the TDataSet in EWB Javascript and produce correct values in various columns.

The code worked but was SLOW, then we added BeginControlUpdate and EndControlUpdate to speed up the processing.  Now the code is fast, but the current row does not update the screen image, even though it has the correct internal values in the TDataSet.  So the screen is not updated.

If the user clicks on a different row, EWB correctly updates that changed row from the previous step.  But obviously we want to change the data in real time.  I tried Grid1.ForceUpdate, but it doesn't help.

I've been pulling out my hair trying to find or remember how to end the edit mode and force an update, but I can't seem to find the answer.  Of course this happens at the 11th hour on a project.

I;m sure there's like one function I call, but I cannot find it.

Thanks in advance.
Erick
EWB Programming Books and Component Library
http://www.erickengelke.com
Thu, Oct 25 2018 6:15 PMPermanent Link

erickengelke

Walter Matte wrote:

When you cycle through the TDataset are you doing and :

Edit; Save; Next;   

or just and

Edit; Next; (which will cause a Save except for the last row?

Walter

Yeah, we're doing that.
I think the problem is that the BeginCOntorlUpdate turns off updating.  If it were Windows, I would invalidate the rect and it would correctly draw in the portion.

If we click on another row, then the display automatically updates correctly.

Erick
EWB Programming Books and Component Library
http://www.erickengelke.com
Tue, Oct 30 2018 2:38 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Erick,

<< The code worked but was SLOW, then we added BeginControlUpdate and EndControlUpdate to speed up the processing.  Now the code is fast, but the current row does not update the screen image, even though it has the correct internal values in the TDataSet.  So the screen is not updated. >>

You need to use DisableControls/EnableControls, not BeginControlUpdate/EndControlUpdate.  The former forces an update of all bound controls when the reference count reaches 0, whereas the latter does not.

Tim Young
Elevate Software
www.elevatesoft.com
Tue, Oct 30 2018 2:51 PMPermanent Link

erickengelke

Tim Young [Elevate Software] wrote:

Erick,

<< The code worked but was SLOW, then we added BeginControlUpdate and EndControlUpdate to speed up the processing.  Now the code is fast, but the current row does not update the screen image, even though it has the correct internal values in the TDataSet.  So the screen is not updated. >>

> You need to use DisableControls/EnableControls, not BeginControlUpdate/EndControlUpdate.  The former forces an update of all bound controls when the reference count reaches 0, whereas the latter does not.

Thanks.

Erick
EWB Programming Books and Component Library
http://www.erickengelke.com
Image