FMX.Grid.TColumn.CellControlByRow function - delphi

I tried to compile file FMXTee.Chart.Grid.pas from TeeChart 9 for XE10 that used CellControlByRow function in FMX.Grid.pas for the following code :
with TColumnAccess(Columns[Col]).CellControlByRow(Row).BoundsRect.BottomRight do begin ... end;
I get running well when using RAD XE10 Seattle, and now I tried with RAD XE10.1 Berlin but get error message : [dcc32 Error] FMXTee.Chart.Grid.pas(1507): E2003 Undeclared identifier: 'CellControlByRow'
Then I compare file FMX.Grid.pas from XE10 packages versus FMX.Grid.pas from XE10.1 packages, and there are a lot of differences especially CellControlByRow() function does not exist any more in FMX.Grid.pas from XE10.1.
Now, I want ask how to change the code that use CellControlByRow function so it will run in RAD XE10.1 Berlin ?

I would like suggest you replace the code below:
result:=TColumnAccess(Columns[Col]).CellControlByRow(Row).BoundsRect.BottomRight;
For next :
...
var tmp : TFmxObject;
begin
tmp:=TColumnAccess(Columns[Col]).CellControl;
result:=TControl(tmp).BoundsRect.BottomRight
...
The above code should fix the compilation problem you’re experiencing. Could you confirm that?

Related

Indy/ssl cannot open file

I'm trying to use ssl with Indy and keep getting the following error:
Project MtApp.exe raised exception class EFOpenError with message 'Cannot open file "C:\Development\MyApp\Win64\Debug\㩃䑜癥汥灯敭瑮作浡牡屵汁呬楨杮即獹潬屧祓䱳杯楓屭祓䱳杯楓䍭湯潳敬坜湩㐶䑜扥杵浜剹潯䍴⹁数m". The system cannot find the file specified'.
It occurs in the IdSSLOpenSSL.pas file in the following function:
function by_Indy_unicode_file_ctrl(ctx: PX509_LOOKUP; cmd: TIdC_INT; const argc: PAnsiChar; argl: TIdC_LONG; out ret: PAnsiChar): TIdC_INT; cdecl;
The argc parameter appears to be passed in correctly. The IDE debugger shows it as "C:\Development\MyApp\Win64\Debug\myRootCA.pem". The problem seems to be when it is cast as a PWideChar and assigned to a String variable:
X509_FILETYPE_PEM:
begin
// Note that typecasting an AnsiChar as a WideChar is normally a crazy
// thing to do. The thing is that the OpenSSL API is based on ASCII or
// UTF8, not Unicode and we are writing this just for Unicode filenames.
LFileName := PWideChar(argc);
LOk := Ord(Indy_unicode_X509_load_cert_crl_file(ctx, LFileName, X509_FILETYPE_PEM) <> 0);
end;
The LFileName variable is 㩃䑜癥汥灯敭瑮作浡牡屵汁呬楨杮即獹潬屧祓䱳杯楓屭祓䱳杯楓䍭湯潳敬坜湩㐶䑜扥杵浜剹潯䍴⹁数m after the cast, causing a FileNotFound exception.
What am I doing wrong?
You did not say which version of Delphi or Indy you are using. But, the code you have shown is not the latest code that is currently in Indy.
What you have described was due to a regression bug that Embarcadero introduced in the Indy release that shipped in RAD Studio 10.3. They fixed that in a patch for RAD Studio 10.3.3:
https://blogs.embarcadero.com/rad-studio-10-3-3-indy-server-ssl-certificate-patch/
https://cc.embarcadero.com/item/30906
I suggest you update to the latest version of Indy from its GitHub repo:
https://github.com/IndySockets/Indy/
https://github.com/IndySockets/Indy/wiki/Updating-Indy

TMapAccess.maReadWrite not defined using DELPHI 11

the code fragment below works fine for DELPHI 10.4 and FMX framework, but does not compile using DELPHI 11 . Error : maReadWrite not defined
[dcc64 Error] ImageUnit.FMX.pas(5340): E2003 Undeclared identifier: 'maReadWrite'
How to solve this issue and how to write code which compiles using DELPHI 10.4 and DELPHI 11 ?
var bit : TBitmap;
begin
if (Bit.Map(TMapAccess.maReadWrite, bitdata1)) then
try
for i := 0 to Bit.width - 1 do
for j := 0 to Bit.height - 1 do
begin
The TMapAccess values that begin with the ma prefix were deprecated before 10.4 to drop the prefix (ie maRead -> Read, maWrite -> Write, maReadWrite -> ReadWrite). You should have gotten compiler warnings about this in 10.4.
The prefixed values were finally removed completely in 11.0 Alexandria.
So, the correct way to write this code for both versions is to simply use the newer non-prefixed value names, eg:
if (Bit.Map(TMapAccess.ReadWrite, bitdata1)) then

CromisIPC compilation error on DELPHI 7

I get the CromisIPC cromis ipc site download and compile/rum successfully the demos and custom project on delphi XE5. Without any error.
But, when I get the same code and put on DELPHI 7 project, I have an error on unit Cromis. AnyValue, an compilation error.
TAnyValue = packed record
private
ValueData: TValueDataType;
{$IFDEF AnyValue_HookingOff}
IntfData : IInterface;
{$ELSE}
{$IFNDEF CPUX64}
Padding : array [0..3] of Byte;
{$ENDIF}
{$ENDIF}
ValueType: TValueType;
function GetAsInt64: Int64; inline;
Exactly on lyne:
ValueData: TValueDataType;
[Error] Cromis.AnyValue.pas(210): ',' or ':' expected but identifier 'ValueData' found
[Error] Cromis.AnyValue.pas(219): 'END' expected but 'FUNCTION' found
I use delphi 7 on a 64 bits windows 7 with a 32 bits VCL project.
The same code compiles on XE5.
What happens here ? any idea ?
tl;dr This code is not designed to work under Delphi 7.
Visibility specifiers are not allowed in Delphi 7 records. The compiler is objecting to the use of private. You can remove that, but then the next problem will be all the methods that are declared on the record. Again, they are not available in Delphi 7.
You might be able to make some headway by switching from packed record to packed object. However, I think it highly unlikely that this will be smooth sailing. Expect a lot of work to make this code compile on Delphi 7. Frankly, you would need to be a Delphi expert to take on this task.
You might try to find an old version of the library that actually supports Delphi 7. You might be able to get one from the library's author. But note that the website says:
All code is Delphi 2006 and upwards compatible. I will not support older Delphi version. If you still use them, then its time to upgrade.
Which leads to the other obvious solution. Upgrade to a modern version of Delphi.
If that is impossible, then you should look for a different library.

delphi E2003 undeclared identifier 'self'

I need a bit of help; I'm helping a friend port a Delphi app built years back to newer versions of Windows, as it currently only runs on Windows 95.
The code utilises 3rd party libraries from Woll2Woll for DB operations.
One of these libraries generates the error E2003 Undeclared identifier: 'self'.
I've been through a number of sites via Google and with my limited knowledge of Delphi (stemming from my Pascal training about 12 years ago and extrapolating my slightly rusted PHP, BASH, ColdFusion and ASP coding skills), I've run into a brick wall - I'm strapped for time and can't make sense of the info I'm coming across on the web.
The problematic code segment is from the wwwQuery.pas file and looks like this:
{$ifdef wwDelphi3Up}
procedure TwwQuery.OpenCursor(InfoQuery: Boolean);
{$else}
procedure TwwQuery.OpenCursor;
{$endif}
begin
{$ifdef wwDelphi3Up}
inherited OpenCursor(InfoQuery);
{$else}
inherited OpenCursor;
{$endif}
//Modded by Arie
//wwSaveAnswerTable(self, Handle, FAnswerTable);
wwSaveAnswerTable(self, Handle, 'FAnswerTable');
end;
The precise error messages are:
[DCC Error] wwQuery.pas(243): E2003 Undeclared identifier: 'self'
[DCC Error] wwQuery.pas(244): E2029 '.' expected but ';' found
[DCC Fatal Error] wwcommon.pas(285): F2063 Could not compile used unit 'wwQuery.pas'
Line 243 is the 2nd last line, just above the end;
The wwSaveAnswerTable function looks like this:
Function wwSaveAnswerTable(ADataSet: TDBDataSet; AHandle: HDbiCur; tableName: string): boolean;
What must I change the Self parameter to, to stop the compile error?
Thanks a stack.
The problem is related to compiler define wwDelphi3Up or any related up in code.
As you see next error message: [DCC Error] wwQuery.pas(244): E2029 '.' expected but ';' found
Compiler expects end of program, and line wwSaveAnswerTable(self, Handle, 'FAnswerTable'); are not compiled inside OpenCursor method. That's why Self is not defined.
You don't need to change parameter, because for sure will affect functionality.
Try to compile it without defines, if you are not use an ancient version of Delphi:
procedure TwwQuery.OpenCursor(InfoQuery: Boolean);
begin
inherited OpenCursor(InfoQuery);
wwSaveAnswerTable(self, Handle, 'FAnswerTable'); // Here prob FAnswerTable without quotes
end;

IDE compiles successfully, but dcc32 writes: Error: E2010 Incompatible types: 'Integer' and 'NativeInt'

Delphi XE2 Update 3 IDE compiles the project successfully, but dcc32.exe writes:
Embarcadero Delphi for Win32 compiler version 22.0
Copyright (c) 1983,2010 Embarcadero Technologies, Inc.
ehshelprouter.pas(137) Error: E2010 Incompatible types: 'Integer' and 'NativeInt'
ehs_reg.pas(68) Fatal: F2063 Could not compile used unit 'ehshelprouter.pas'
Why? Line 137 is:
Application.OnHelp := OnRouteHelp; // function OnRouteHelp(Command: Word; Data: NativeInt; var CallHelp: Boolean): Boolean;
Thanks for the help!
Check the line in question. If it's saying that two types that should be compatible are incompatible, then there's something more complicated than simple assignment going on. If I had to guess, something is passing a function pointer around and the API has changed. Try checking for that case...
Your are using an older dcc32.exe by mistake (Delphi XE perhaps?). Check your PATH-setting or provide the full path to XE2 dcc32.exe in your compilation.
XE2 should display this version info:
Embarcadero Delphi for Win32 compiler version 23.0
Have you double-checked that you're not compiling for Win64 with the command line? (i.e. verify it is actually dcc32.exe that is called).
In that case NativeInt is 64bits and that would be normal to raise this error.
Also, are you trying to do a full build using the -B option like (c:\program files\embarcadero\rad studio\9.0\bin\dcc32.exe -$O- -$W+ --no-config-B-Q...) or simple compile with the -M option like (c:\program files\embarcadero\rad studio\9.0\bin\dcc32.exe -$O- -$W+ --no-config-M-Q...)?
I would also try to wipe out all the dcus to see if it helps.
And since it works from the IDE, try with capturing the command line shown in the Messages area and try that exact same line in a console.

Resources