自定义功能区
系统管理员可使用 Windchill Desktop Integration 在 Microsoft Office 应用程序的 Windchill 选项卡上引入自定义按钮。唯一的要求是存在一个有效的 XML 文件,此文件对自定义功能区 UI 进行了定义。此文件必须位于以下位置:
<Windchill>\codebase\com\ptc\windchill\enterprise\nativeapp\msoi\client\custom\wtCustomMenu.xml
有关功能区 UI 的详细信息,请参阅 Microsoft 功能区文档
需要实现的所有自定义操作都必须位于操作组内部。这将用作 XML 中自定义功能区 UI 的 root/document 元素。
button 节点作为子节点添加到组,这样该节点便可作为可单击项显示在功能区 UI 上。
以下示例显示了一个具有两个按钮的自定义操作组:
<group id="MyCustomActions" tag="MyCustomActions"
getLabel="MsoiGetLabel" getScreentip="MsoiScreentip"
getVisible="MsoiServerVisible">
<button id="CustomAction01" tag="CustomAction01" enabled="true"
label="Custom Action 01"
screentip="Click this to launch the first custom action"
getImage="MsoiGetImage" onAction="MsoiOnAction" keytip="ca1"/>

<button id="CustomAction02" tag="CustomAction02" getEnabled="MsoiIsEnabled"
getLabel="MsoiGetLabel" getScreentip="MsoiScreentip" getImage="MsoiGetImage"
onAction="MsoiOnAction" keytip="ca2"/>
</group>
要控制该组的可见性:
getVisible - 要使该组仅在连接到活动 Windchill 服务器时可见,请将此属性设置为 MsoiServerVisible
visible - 如果要使该组始终可见,请移除 getVisible 属性并将 visible 设置为 true
要控制按钮状态:
getEnabled - 如果将此属性设置为 MsoiIsEnabled,则该按钮将保持禁用状态,除非服务器端更改显式呈现按钮已启用或已禁用。
enabled - 如果要在每次组可见时都启用该按钮,请从 button 节点移除 getEnabled 属性,并将 enabled 设置为 true
* 
属性 labelscreentip 分别用于控制按钮的标签和工具提示。通常情况下,静态文本可略微提升性能。
要本地化自定义菜单,必须改用 getLabelgetScreentip
创建应用程序特定自定义菜单
Windchill Desktop Integration 支持针对特定的 Microsoft Office 应用程序自定义功能区 UI。将短应用程序名称附加到文件名。例如,以下文件将创建一个仅在 Microsoft Excel 中显示的新按钮:
<Windchill>\codebase\com\ptc\windchill\enterprise\nativeapp\msoi\client\custom\wtCustomMenuExcel.xml
请添加下列代码:
<?xml version="1.0"?>
<groups>
<group id="ExcelActionsGroup" tag="ExcelActionsGroup"
label="Excel actions group" screentip="Custom Excel
actions group" visible="true">
<button id="MyExcelButton" tag="MyExcelButton" enabled="true"
label="Invoke my own custom Excel action"
screentip="Clicking here will launch my own Excel action."
getImage="MsoiGetImage" onAction="MsoiOnAction" keytip="ea"/>
</group>
</groups>
本地化文本
Windchill Desktop Integration 可用于对功能区 UI 上显示的文本进行本地化。这使得最终用户能够以其本国语言查看翻译。
* 
仅当 labelscreentip 属性替换为 getLabelgetScreentip 属性时,才能进行功能区按钮标签和屏幕提示的本地化。这些属性的值必须分别设置为 MsoiGetLabelMsoiScreentip
PTC 建议将 idtag 属性按唯一文本保留。Windchill Desktop Integration 使用 tag 属性进行进一步处理,具体如下所述。
要本地化功能区 UI,请执行以下操作:
1. 本地化标签。
将新节点添加到服务器上的以下文件 (或其区域设置特定对应项):
<Windchill>\codebase\com\ptc\windchill\enterprise\nativeapp\msoi\client\custom\wtCustomLabels.xml
例如,将相关节点文本添加到 wtCustomLabels_ru.xml 会将该菜单翻译为俄语。
节点的格式如下:
<CustomAction02>
<short>Custom Action 02</short>
</CustomAction02>
父节点名称 ("CustomAction02") 必须与 tag 组和按钮的属性相匹配。
2. 本地化工具提示。
这与标签的本地化类似,不同之处在于子节点应命名为 tooltip。节点的格式如下:
<CustomAction02>
<short>Custom Action 02</short>
<tooltip>Click here to launch this custom action</tooltip>
</CustomAction02>
3. 将翻译部署到所有客户端。
在服务器上保存所做更改后,Windchill Desktop Integration 客户端会自动拾取此文件的副本。
这对您有帮助吗?