您的位置:首页 > 其它

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

2012-07-30 21:42 911 查看
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.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐