You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

TMS WEB Core自定义非可视组件编译报错:未找到TMSWebPlatform

问题:自定义TMS WEB Core非可视组件编译报错“identifier not found 'TMSWebPlatform'”

我按照TMS WEB Core的自定义组件开发文档构建非可视组件,已成功编译并安装BPL到Delphi IDE,组件能在面板找到并放到窗体,但编译Web应用时出现错误:

[Error] MyTestCustomComponents.pas(9): identifier not found "TMSWebPlatform"

我的组件单元代码如下:

unit MyTestCustomComponents;

interface

uses
  System.SysUtils, System.Classes, WebLib.Controls;

type
  [ComponentPlatforms(TMSWebPlatform)]
  TMyWebComponent = class(TComponent)
  private
    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
  published
    { Published declarations }
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('My Web Test Components', [TMyWebComponent]);
end;

end.
解决方案
  • 问题根源:TMSWebPlatform常量并不在WebLib.Controls单元中,而是定义在WebLib.Constants单元里,你的uses列表缺少这个单元引用。
  • 修复步骤:
    1. 在interface段的uses列表中添加WebLib.Constants:
      uses
        System.SysUtils, System.Classes, WebLib.Controls, WebLib.Constants;
      
    2. 重新编译组件包并安装到IDE,再重新编译Web应用即可解决该错误。

额外建议:对于TMS WEB Core的非可视组件,推荐直接继承TWebCustomComponent(位于WebLib.Controls单元),它是专门为Web环境设计的非可视组件基类,比直接继承TComponent更适配框架特性。

内容的提问来源于stack exchange,提问作者Shaun Roselt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.30 13:07:19