Home > DMT_EditorControl > activateDocument
DMT_EditorControl.activateDocument() method
激活文档
签名
typescript
function activateDocument(tabId: string): Promise<boolean>;1
参数名
参数 | 类型 | 描述 |
|---|---|---|
tabId | string | 标签页 ID |
返回值
Promise<boolean>
操作是否成功
备注
切换到指定文档的标签页,并将输入焦点置于其中
示例
javascript
// 1. 先后打开原理图页与 PCB,此时焦点在最后打开的 PCB 上
const pages = await eda.dmt_Schematic.getAllSchematicPagesInfo();
const pcbs = await eda.dmt_Pcb.getAllPcbsInfo();
const tabSch = await eda.dmt_EditorControl.openDocument(pages[0].uuid);
await eda.dmt_EditorControl.openDocument(pcbs[0].uuid);
// 2. 激活原理图标签页(真实切换回原理图画布)
const activated = await eda.dmt_EditorControl.activateDocument(tabSch);
console.log('activated:', activated);1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9