我正在为 delphi 7
和 delphi 2006
开发组件,该组件使用 synopse 中的 SynTaskDialog.pas
,我已经在delphi 7
组件中成功使用了SynTaskDialog.pas
,但是当我尝试在delphi 2006
中使用它来创建组件包时。我收到错误
我在 synopse.info/forum 上找到了相同的解决方案
<小时/>引用:
我找到了两种解决方法:要么
- 用字符串数组替换指针数组,例如
TD_ICONS_IDENT: array[TTaskDialogIcon] of string =( '', SMsgDlgWarning, SMsgDlgConfirm, SMsgDlgError, SMsgDlgInformation, '', SMsgDlgInformation);
并删除一些 LoadResString 调用或
2.用类似函数替换指针数组
<小时/>GetIconIdent(TTaskDialogIcon): Pointer
但即使在那之后我也无法编译该组件的包。这些错误来了
[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'
最佳答案
为什么不问项目论坛的问题?
解决方案可以增强此开源单元的官方代码。
好的 - 它可能会帮助我获得一些 SO 积分。 ;)
据我所知,这个“E2001”问题已经被识别 - 请参阅 this post并且应该已修复在最新的主干中。这听起来适用于 Delphi 7,但不适用于 Delphi 2006。
以下是此编译器错误的潜在解决方法:
定义这样一个函数:
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;
这样使用:
if Inst='' then
Inst := IconMessage(aDialogIcon);
现在是committed in the project trunk .
感谢您使用我们的开源组件!
关于delphi 2006,自定义组件中的SynTaskDialog编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10510428/