1

I am using TcxGridDBBandedTableView and have two columns of type TcxGridDBBandedColumn.

vwABC : TcxGridDBBandedTableView
vwABCField1 : TcxGridDBBandedColumn
vwABCField2 : TcxGridDBBandedColumn

When I change anything in vwABCField1, vwABCField2 values should get cleared. For this I am using OnEditValueChanged property of vwABCField1 like this:

procedure TMyForm.vwABCField1PropertiesEditValueChanged(Sender: TObject);
begin
 vwABCField2.EditValue := '';
end;

While debugging, when I come to vwABCField2.EditValue := ''; statement, I never return back and get trapped in infine loop and after some time I get stackoverflow error.

vwABCField2.EditValue := ''; is calling vwABCField1PropertiesEditValueChanged procedure again and again recursively infinite time. I don't know why. I have not declared anything on OnEditValueChanged event of vwABCField2.

Update

If I write anything else in the above function instead of vwABCField2.EditValue := '';, it will be called only once. For example

procedure TMyForm.vwABCField1PropertiesEditValueChanged(Sender:TObject); 
begin 
 ShowMessage("hi"); 
end;

works fine. So I suspect that culprit is vwABCField2.EditValue := ''; statement.

asked Feb 18, 2014 at 9:20
10
  • @StefanGlienke - Yes I checked. vwABCField1PropertiesEditValueChanged method is getting called again and again. Commented Feb 18, 2014 at 9:23
  • You should see where it comes from the 2nd time as you said that should not happen Commented Feb 18, 2014 at 9:24
  • 2
    Stackoverflow error shocked Commented Feb 18, 2014 at 9:24
  • 1
    Maybe the change to vwABCField2 forces some kind of update to the database and then all fields all traversed and another Change() is triggered. Look at the call stack, trace the DevEx code, make a reproducable case to post in the DevEx forums. Commented Feb 18, 2014 at 10:44
  • 1
    And have you searched the DevEx forums for 'stack overflow'? Could this be related: devexpress.com/Support/Center/Question/Details/Q523958 Commented Feb 18, 2014 at 10:46

1 Answer 1

3

As in the official documentation is stated:

Do not change the edit value in your OnEditValueChanged event handler, as this can result in stack overflow. Use this event to get notification that the edit value has changed.

Because when you change the edit value in this event, of course, your editvalue is changed and therefore calling the OnEditValueChanged event again and again and ...

answered Feb 18, 2014 at 11:33
Sign up to request clarification or add additional context in comments.

6 Comments

Then where should I change the edit values of other cells in that row? What should I do in my case? Also, can you provide the link for this documentation?
This documentation should be available in your IDE Help, even context sensitive. Go to your Delphi Help and lookup the 'ExpressQuantumGrid Suite' topic in the contents tab.
And about the question on where to change other values: you better do that on the dataset side, the datasets 'onchange' or 'beforepost' event e.g.
When I add editvalue code in dsABCBeforePost, again I get trapped in the infinite loop resulting to stackoverflow.
I added all the editvalue code into the dsABCField1OnChange event and it worked. Thanks for your suggestions Copilot :)
|

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.