'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.
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.
相关文章推荐
- 解决 'Could not convert variant of type (NULL) into type (String)'
- RM6.5_XE5 异常 Could not convert variant of type(UnicodeString) into type(Double)
- 方天ERP 解决委外产品入库 提示:could not convert variant of type(null) into type (double)
- 解决dev express quantumgrid v6.30使用中出现'Overflow while converting variant of type(Integer) into type(Date)'的错误
- The requested list key 'map' could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or peopl
- 'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type 'unsigned int (void *)'
- Grandle编译时报错:Could not create plugin of type 'AppPlugin'
- 关于AndroidStudio运行项目时出现 Could not create plugin of type 'AppPlugin'.
- Excel打开错误提示 'c:\program files\...\..convert software.xla' could not be found
- Error:Could not get unknown property ‘apkVariantData’ for object of type com.android.build.gradle.in
- Gradle编译出现Could not create plugin of type 'AppPlugin'
- <iOS> The operation could not be performed because of one or more tree conflicts.
- mapper提示Could not autowire. No beans of … type found?
- .NET Web 执行错误Could not load type '...' from assembly '..., Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' because the me
- afxbeginthread Error 11 error C2665: 'AfxBeginThread' : none of the 2 overloads could convert all th
- android NDK开发编译时出现Type 'jint' could not be resolved和Unresolved inclusion: <jni.h>的解决办法
- ios学习之路(知识点)Values of type 'NSInteger' should not be used as format arguments...
- Could not find method android() for arguments on root project '项目名' of type org.gradle.api.Project.
- Could not create task or type of type: junit
- System.TypeLoadException: Could not load type 'System.DateTimeOffset' from assembly 'mscorlib, Version=2.0.0.0, Culture=neutral,