Question

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

enter image description here

i have found a solution for the same on synopse.info/forum


Quote:

I've found two workarounds: Either

  1. 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'
Was it helpful?

Solution

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top