【发布时间】:2012-07-20 18:58:04
【问题描述】:
试图让自定义对话框与按钮名称武器 1 、武器 2 和取消一起工作。但是使用此代码,当我尝试编译它时,它会在 Result 上给出错误未定义 错误信息是
[DCC 错误] ssClientHost.pas(760): E2003 Undeclared identifier: 'Result'
代码是:
with CreateMessageDialog('Pick What Weapon', mtConfirmation,mbYesNoCancel) do
try
TButton(FindComponent('Yes')).Caption := Weapon1;
TButton(FindComponent('No')).Caption := Weapon2;
Position := poScreenCenter;
Result := ShowModal;
finally
Free;
end;
if buttonSelected = mrYes then ShowMessage('Weapon 1 pressed');
if buttonSelected = mrAll then ShowMessage('Weapon 2 pressed');
if buttonSelected = mrCancel then ShowMessage('Cancel pressed');
【问题讨论】:
-
是“结果”未定义还是“显示模式”未定义?
-
[DCC 错误] ssClientHost.pas(760): E2003 Undeclared identifier: 'Result'
-
那么你不在一个函数中。结果是函数的结果,在过程中没有意义,所以不可用。
标签: delphi