Main Content

appdesigner.customcomponent.configureMetadata

配置在 App 设计工具中使用的自定义 UI 组件

自 R2021a 起

    说明

    示例

    appdesigner.customcomponent.configureMetadata(classfile) 打开对话框,为 classfile 指定的 UI 组件类配置 App 设计工具元数据。此元数据使组件能够出现在 App 设计工具组件库中,并可以在画布中以交互方式使用。

    该函数生成名为 resources 的文件夹,其中包含元数据。在共享 UI 组件时共享此文件夹。

    示例

    全部折叠

    使用“App 设计工具自定义 UI 组件元数据”对话框配置现有 UI 组件类,以使其能在 App 设计工具中使用。

    假设您创建了 matlab.ui.componentcontainer.ComponentContainer 基类的一个子类,并将该类文件保存为文件夹 C:\MyComponents 中的 IPAddressComponent.m。启动对话框来配置 IPAddressComponent 使其可以在 App 设计工具中使用。

    appdesigner.customcomponent.configureMetadata("C:\MyComponents\IPAddressComponent.m")

    App Designer Custom UI Component Metadata dialog box. The dialog box lists the component file and provides fields for customizing the component metadata. The Component Library Appearance section contains fields for the component name, category, and icon. The Component Details section contains fields for the component description, version, author's name, and author's email. The bottom of the dialog box shows Help, OK, and Cancel buttons.

    填写表单,然后选择确定。该函数使用 C:\MyComponents 文件夹中的指定元数据生成名为 resources 的文件夹。将 C:\MyComponents 添加到 MATLAB® 路径,并在 App 设计工具中打开一个 App 以在组件库中查看您的组件。

    输入参数

    全部折叠

    UI 组件类文件的路径,指定为字符向量或字符串标量。classfile 可以是绝对路径或相对路径。

    示例: 'C:\MyComponents\IPAddressComponent.m'

    示例: "IPAddressComponent.m"

    详细信息

    全部折叠

    对话框选项

    下表摘要显示了“App 设计工具自定义 UI 组件元数据”对话框中的每个选项。

    选项摘要
    名称组件在 App 设计工具组件库中显示的名称。
    类别 组件所在的组件库的类别。从下拉列表中选择一个现有类别,或通过输入名称来创建一个新类别。
    图标出现在组件库中组件名称上方的图标。在您的计算机上选择一个 .gif.jpeg.jpg.png 文件。
    描述用户在将鼠标悬停在组件库中的组件上时看到的说明。
    版本组件版本,指定为 Major.Minor。默认值为 1.0。对组件进行轻微改动后,增大小数点后的数字;进行重大改动后,增大小数点前的数字。
    作者姓名用户在将鼠标悬停在组件库中的组件上时,会看到的组件作者的姓名。
    作者电子邮件用户在将鼠标悬停在组件库中的组件上时,会看到的组件作者的电子邮件地址。

    版本历史记录

    在 R2021a 中推出