In Version 4.2.3, programmatically setting a TcxGridDBLayoutView's Controller.Customization to True trows an Integer Overflow.
Worked perfectly in 4.2.2
The error seems to come from (unsure) :
unit dxComCtrlsUtils;
procedure cxTreeViewGetSelection(ATreeView: TTreeView; AList: TList);
var
I: Integer;
begin
for I := 0 to ATreeView.SelectionCount - 1 do
AList.Add(ATreeView.Selections[I].Data);
end;
Hello Stephan,
I was not able to reproduce this behavior. Attached is an example, that operates as expected on my side. Please modify it to illustrate the problem, and attach it to your next message. We will examine it and do our best to find a solution. I am looking forward to hearing from you.
Paulo,
I haven't been able to reproduce _Excatly_ the problem I described but, I managed to create a sample program that clearly shows a problem (attached).
In order to reproduce the problem, run the program, click the Customize button once, then click OK. Repeat a few times (customize then OK). You should have an access violation error after 4-5 retry.
I found something interesting in dxComCtrlsUtils.pas (line ~ 200)
The original code is :
Procedure cxTreeViewGetSelection(ATreeView: TTreeView; AList: TList);
var
I: Integer;
begin
for I := 0 to ATreeView.SelectionCount - 1 do
AList.Add(ATreeView.Selections[I].Data);
end;
In some cases, ATreeView.SelectionCount yields 0 (zero). So ATreeView.SelectionCount - 1 yields -1 throwing the Integer Overflow error.
Here's the correction I applied to the code to fix the problem. I hope it'll help you guys !
Procedure cxTreeViewGetSelection(ATreeView: TTreeView; AList: TList);
var
I: Integer;
begin
if ATreeView.SelectionCount > 0 then begin // Check if larger than 0
for I := 0 to ATreeView.SelectionCount - 1 do begin
AList.Add(ATreeView.Selections[I].Data);
end;
end;
end;
Hello Stephan,
Thank you for your sample project. I have reproduced the described behavior and forwarded this ticket to our developers for research.