delphi 2006, SynTaskDialog compilation error in custom component - delphi

i am working on component for delphi 7 and delphi 2006, the component uses SynTaskDialog.pas from synopse, i have successfully used the SynTaskDialog.pas in delphi 7 component, but when i try to use it in delphi 2006 to create a component package. i get an error
i have found a solution for the same on synopse.info/forum
Quote:
I've found two workarounds: Either
replace the pointer arrays with string arrays like
TD_ICONS_IDENT: array[TTaskDialogIcon] of string =(
'', SMsgDlgWarning, SMsgDlgConfirm, SMsgDlgError, SMsgDlgInformation,
'', SMsgDlgInformation);
and remove some LoadResString calls or
2.replace the pointer arrays with functions like
GetIconIdent(TTaskDialogIcon): Pointer
but even after that i cannot compile the package for the component. and these errors come
[Pascal Error] E2201 Need imported data reference ($G) to access 'SMsgDlgOK' from unit 'SynTaskDialog'
[Pascal Error] E2201 Need imported data reference ($G) to access 'SMsgDlgYes' from unit 'SynTaskDialog'
[Pascal Error] E2201 Need imported data reference ($G) to access 'SMsgDlgNo' from unit 'SynTaskDialog'
[Pascal Error] E2201 Need imported data reference ($G) to access 'SMsgDlgCancel' from unit 'SynTaskDialog'
[Pascal Error] E2201 Need imported data reference ($G) to access 'SMsgDlgRetry' from unit 'SynTaskDialog'
[Pascal Error] E2201 Need imported data reference ($G) to access 'SCloseButton' from unit 'SynTaskDialog'

Why didn't you ask the question of the project forum?
A solution may enhance the official code of this Open Source unit.
OK - it may help me gain some SO points. ;)
AFAIK this "E2001" issue has already been identified - see this post and should have been fixed in the latest trunk. This is what sounds to work with Delphi 7, but not with Delphi 2006.
Here is a potential workaround of this compiler bug:
Define such a function:
function IconMessage(Icon: TTaskDialogIcon): string;
begin
case Icon of
tiWarning: result := SMsgDlgWarning;
tiQuestion: result := SMsgDlgConfirm;
tiError: result := SMsgDlgError;
tiInformation, tiShield: result := SMsgDlgInformation;
else result := '';
end;
end;
To be used as such:
if Inst='' then
Inst := IconMessage(aDialogIcon);
This is now committed in the project trunk.
Thanks for using our Open Source component!

Related

can i implement `_exit`c function in delphi?

I want to consume c obj files in delphi xe3.
When linked obj files, shows this error:
`[dcc32 Error] Unit1.pas(149): E2065 Unsatisfied forward or external declaration: '_exit'`
can i implement _exit function?
Yes you can indeed do this. Typically you will link the .obj file to a single unit in your project. Implement the exit function in that unit and the Delphi linker will find it.
....
implementation
....
{$LINK foo.obj}
procedure _exit(status: Integer); cdecl;
begin
// your implementation goes here
end;
As I've illustrated this you place the function in the implementation section of the unit. It does not need to be visible externally to the unit.
You might have multiple different units that link to C objects, in which case you can place your C runtime functions, like exit, in a single unit, and use that from each other unit that links to C objects. In that scenario then you need to expose each function in the interface section so that the linker can see the function.

Where is defined the TgtOutFormat type in PDFtoolkit VCL library?

I have a problem to set watermark image format in the TgtImageWatermarkTemplate component (which is part of the Gnostice PDFtoolkit VCL library). I have the following code:
var
Watermark: TgtImageWatermarkTemplate;
begin
...
// create and set watermark properties
Watermark := TgtImageWatermarkTemplate.Create;
Watermark.ImageFormat := ofJPEG; // <- this line fails the compilation
...
end;
But it fails to compile with the following error:
[DCC Error] Unit1.pas(186): E2003 Undeclared identifier: 'ofJPEG'
[DCC Fatal Error] Project1.dpr(5): F2063 Could not compile used unit 'Unit1.pas'
Failed Elapsed time: 00:00:01.5
In which unit is the ofJPEG identifier declared (I think it's member of the TgtOutFormat enumeration)? Which unit should I add to my uses clause?
Please include gtCstPDFDoc unit in your PAS file. The enumeration TgtImageFormat is from that.
UPDATE: The enumeration values start with if and so it is ifJPEG.

Delphi - disable controls not working EMS Advanced Export 4

I tried to disable ABSQuery1 controls before exporting data :
procedure TForm1.QExport4Dialog1BeforeExportRow(Sender: TQExport4;
Row: TQExportRow; var Accept: Boolean);
begin
ABSQuery1.DisableControls;
end;
But I get :
> [dcc32 Error] Unit1.pas(75): E2003 Undeclared identifier: 'TQExport4'
> [dcc32 Error] Unit1.pas(76): E2003 Undeclared identifier:
> 'TQExportRow' [dcc32 Error] Unit1.pas(204): E2005 'TQExport4' is not a
> type identifier [dcc32 Error] Unit1.pas(205): E2005 'TQExportRow' is
> not a type identifier [dcc32 Fatal Error] Project1.dpr(15): F2063
> Could not compile used unit 'Unit1.pas'
What am I doing wrong ?
Your error messages all indicate that you have not used the units in which the named symbols are declared. Add those units, those that declare TQExport4 and TQExportRow, to the uses clause of your Unit1.
It's usually worth consulting the documentation when you encounter a compiler error that you do not understand. Search for the error code, for example E2003. The documentation says:
The compiler could not find the given identifier - most likely it has been misspelled either at the point of declaration or the point of use. It might be from another unit that has not mentioned a uses clause.
The final sentence covers your scenario, although the author got in a tangle when writing that text and the words don't make a lot of sense. Sigh.
Incidentally, the example at the bottom of that documentation page made me sad. The author indicates a preference, when correcting mis-named variables, for the option requiring the fewest key strokes. Never mind getting the name right, just make it compile with the fewest key strokes and who cares about the next person to read the code. Pah!

Why doesn't the new compiler recognize "NULL" in this old code?

I just downloaded the ADSI and it seems to be that it is not compatible with Delphi Embarcadero XE4.
When I try to compile one of the examples, I get this error:
[dcc32 Error] adshlp.pas(128): E2003 Undeclared identifier: 'NULL'
And this is the line:
varArr := NULL;
What's wrong?
Null used to be declared in the System unit, so it was available globally. In Delphi 6, all Variant-related code moved out of that unit and into the new Variants unit. Since Null is a function that returns a Variant, Null was included in the move, so it is no longer available implicitly.
To fix the old code, simply add Variants to your uses clause in any unit that needs it:
uses ..., Variants;

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;

Resources