-
Notifications
You must be signed in to change notification settings - Fork 61
/
visio.selectionchangedeventargs.yml
84 lines (78 loc) · 2.84 KB
/
visio.selectionchangedeventargs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
### YamlMime:TSType
name: Visio.SelectionChangedEventArgs
uid: 'visio!Visio.SelectionChangedEventArgs:interface'
package: visio!
fullName: Visio.SelectionChangedEventArgs
summary: Provides information about the shape collection that raised the SelectionChanged event.
remarks: |-
\[ [API set: 1.1](/office/dev/add-ins/reference/overview/visio-javascript-reference-overview) \]
#### Examples
```TypeScript
let eventResult; // Global variable to store the EventHandlerResult returned on attaching handler.
function AttachHandler() {
Visio.run(session, function(ctx) {
const doc = ctx.document;
eventResult = doc.onSelectionChanged.add(
function (args) {
console.log("Selected Shape Name: "+args.shapeNames[0]);
});
return ctx.sync().then(function(){
console.log("Handler attached");
});
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
function onSelectionChanged(args) {
console.log(Date.now() + "Selection Changes Event" + JSON.stringify(args));
}
}
function RemoveHandler() {
if (!eventResult || !eventResult.context) {
console.log("Handler has not been attached");
return;
}
Visio.run(eventResult.context, function(ctx) {
eventResult.remove();
return ctx.sync().then(function (){
eventResult = null;
console.log("Handler removed");
});
}).catch(function(error) {
console.log("Error: " + error);
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
}
```
isPreview: false
isDeprecated: false
type: interface
properties:
- name: pageName
uid: 'visio!Visio.SelectionChangedEventArgs#pageName:member'
package: visio!
fullName: pageName
summary: Gets the name of the page which has the ShapeCollection object that raised the SelectionChanged event.
remarks: '\[ [API set: 1.1](/office/dev/add-ins/reference/overview/visio-javascript-reference-overview) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'pageName: string;'
return:
type: string
- name: shapeNames
uid: 'visio!Visio.SelectionChangedEventArgs#shapeNames:member'
package: visio!
fullName: shapeNames
summary: Gets the array of shape names that raised the SelectionChanged event.
remarks: '\[ [API set: 1.1](/office/dev/add-ins/reference/overview/visio-javascript-reference-overview) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'shapeNames: string[];'
return:
type: 'string[]'