以编程方式使用

您可以通过两种方式以编程方式访问类别。您可以按索引(其中 0 是顶级类别)访问它:

var category = toolbox.getToolboxItems()[0];

也可以按 ID 访问:

var category = toolbox.getToolboxItemById('categoryId');

其中 ID 在工具箱定义中指定:

JSON

{
  "kind": "category",
  "name": "...",
  "toolboxitemid": "categoryId"
}

XML

<category name="..." toolboxitemid="categoryId"></category>