'Could not convert variant of type (Array Byte) into type (Integer)

This is actually a report for ExpressQuantumGrid Suite (not ExpressEditors Library) but it is not obvious how to change the Product/Technology on the Edit Issue page after the ticket has already been created.

The following exception occurs in TcxGrid when trying to select multiple cells using the mouse using drag operations.

'Could not convert variant of type (Array Byte) into type (Integer)'

I attached a simpler project that includes all the necessary files for reproducing the error. It also includes a screenshot with the error message.

This error occurs in on line 8939 in cxCustomTableView.pas, in the method TcxCustomGridTableController.IsPullFocusingPosChanged. It only happens in grid mode, with cell multi-select enabled, when FPullFocusingRecordId is a byte array variant.

This might actually be a bug in the Delphi RTL that is not able to compare two byte array variants. I implemented the following simple workaround in cxCustomTableView.pas and this fixed the error:

function SameRecordID(V1, V2: Variant): Boolean;
var
I: Integer;
begin
if VarIsArray(V1) and VarIsArray(V2) then
begin
if (VarArrayLowBound(V1, 1) = VarArrayLowBound(V2, 1)) and (VarArrayHighBound(V1, 1) = VarArrayHighBound(V2, 1)) then
for I := VarArrayLowBound(V1, 1) to VarArrayHighBound(V1, 1) do
if V1[I] <> V2[I] then
begin
Result := False;
Exit;
end;
Result := True;
end
else
Result := V1 = V2;
end;

function TcxCustomGridTableController.IsPullFocusingPosChanged: Boolean;
begin
Result := not SameRecordID(FPullFocusingRecordId, DataController.GetRowId(FocusedRecordIndex)) or
(FPullFocusingItem <> FocusedItem);
end;

The error does not occur when DataModeController.GridMode is False, because in this case the two record IDs being compared are two integers.

I really hope you will be able to reproduce it this time. Please let me know if you need more information.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值