次の方法で共有


Visio.SelectionChangedEventArgs interface

SelectionChanged イベントが発生した図形のコレクションに関する情報を提供します。

注釈

[ API セット: 1.1 ]

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));
        }
    });
}

プロパティ

pageName

SelectionChanged イベントが発生した ShapeCollection オブジェクトのあるページの名前を取得します。

shapeNames

SelectionChanged イベントが発生した図形名の配列を取得します。

プロパティの詳細

pageName

SelectionChanged イベントが発生した ShapeCollection オブジェクトのあるページの名前を取得します。

pageName: string;

プロパティ値

string

注釈

[ API セット: 1.1 ]

shapeNames

SelectionChanged イベントが発生した図形名の配列を取得します。

shapeNames: string[];

プロパティ値

string[]

注釈

[ API セット: 1.1 ]