Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delphi XE2 not compatable with Delphi 7

Status
Not open for further replies.

MLNorton

Programmer
Nov 15, 2009
134
US
I have been using Delphi 7 for several years with no problem. When I swiched to Delphi XE2 I get compilers errors in previously working programs. Is there a solution to this compatability problem? Can I run XE2 to respond likr 7?
 
The transition to Unicode will be the biggest change. If you like you could post some code and we can try to assist.
 
The first error was that a variable, “UnitName” was not valid. At this point there was an indication of two errors. I changed the variable name and that problem was resolved. Then I got an err or in the following procedure:
procedure TForm_EditVetOrMem.DBGrid1TitleClick(Column: TColumn);
{$J+}
const PreviousColumnIndex : integer = 1;
{$J-}
begin
if DBGrid1.DataSource.DataSet is TCustomADODataSet
then
with TCustomADODataSet(DBGrid1.DataSource.DataSet) do
begin
if (Pos(Column.Field.FieldName, Sort) = 1)
and (Pos(' DESC', Sort)= 0) then
Sort := Column.Field.FieldName + ' DESC'
else
Sort := Column.Field.FieldName + ' ASC';
end;
end;

There were 7 errors identified with the following error message:

[DCC Error] EditVetOrMem.pas(212): Ambiguous overload lall to Pos
System.pas(25029): Related method: function Pos(const string;const string); Integer;
System.pas(25133): Related method: function Pos(const Widestring;const Widestring); Integer;
[DCC Warning] EditVetOrMem.pas(212): Impplicit string cast with potential data loss from ‘string’ to ‘ShortString’;
 
Try changing Pos to ANSIPos

Any string based function will need to be changed to the ANSI version of the function...

You may also need to cast Column.Field.FieldName to an ANSI string.

if (ANSIPos(ANSIString(Column.Field.FieldName), Sort) = 1) then
 
This solved the problem but there is one more problem. My program consists of 19 seperate programs called from a Memu. In these programs there are several DBGrids. In the DBGrids there is a border but no vertical or horizontal lines. How can I fix this problem?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top