程式輔助存取機制

您可以透過程式輔助方式存取類別,方法有兩種。您可以透過索引存取 (其中 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>