インスタンスマネージャーのプロパティを使用したサブフォームの制御

この例は、(XML フォームオブジェクトモデルに含まれる)インスタンスマネージャーのプロパティを使用して、サブフォームに関する情報を実行時に取得する方法を示しています。

次のフォームでは、インスタンスマネージャーのスクリプティングプロパティを使用することにより、Subform1 に関する情報を 4 つのボタンで提供します。例えば、フォームの入力者が「最大値」ボタンをクリックすると、サポート対象の Subform1 のインスタンスの許可されている最大数を示すメッセージが表示されます。

count プロパティの値を出力するメッセージボックスのスクリプティング

次のスクリプトでは、messageBox メソッドを使用して count プロパティの値を出力します。

    xfa.host.messageBox("The current number of Subform1 instances on the  
    form is:" + properties.Subform1.instanceManager.count, "Instance Manager 
    Properties",3);

次に示すように、アンダースコア(_)を使用してインスタンスマネージャーの count プロパティを参照することにより、このスクリプトを記述することもできます。

    xfa.host.messageBox("The current number of Subform1 instances on the form 
    is: " + properties._Subform1.count, "Instance Manager Properties", 3);

サブフォームのインスタンスがフォーム上に存在しない場合、アンダースコア(_)は特に重要です。

max プロパティの値を出力するメッセージボックスのスクリプティング

次のスクリプトでは、messageBox メソッドを使用して max プロパティの値を出力します。

    xfa.host.messageBox("The maximum number of instances allowed for Subform1 
    is: " + properties.Subform1.instanceManager.max, "Instance Manager 
    Properties", 3);

次に示すように、アンダースコア(_)を使用してインスタンスマネージャーの max プロパティを参照することにより、このスクリプトを記述することもできます。

    xfa.host.messageBox("The maximum number of instances allowed for Subform1 
    is: " + properties._Subform1.max, "Instance Manager Properties", 3);

min プロパティの値を出力するメッセージボックスのスクリプティング

次のスクリプトでは、messageBox メソッドを使用して min プロパティの値を出力します。

    xfa.host.messageBox("The minimum number of instances allowed for Subform1 
    is: " + properties.Subform1.instanceManager.min, "Instance Manager 
    Properties", 3);

次に示すように、アンダースコア(_)を使用してインスタンスマネージャーの min プロパティを参照することにより、このスクリプトを記述することもできます。

    xfa.host.messageBox("The minimum number of instances allowed for Subform1 
    is: " + properties._Subform1.min, "Instance Manager Properties", 3);

subform プロパティの名前を出力するメッセージボックスのスクリプティング

次のスクリプトでは、messageBox メソッドを使用して subform プロパティの名前を出力します。

    xfa.host.messageBox("The name of the subform using the instance manager name 
    property is: " + properties.Subform1.instanceManager.name + 
    ".\n\nNote: This value is different than the value returned by the name 
    property for the Subform1 object." , "Instance Manager Properties", 3);

次に示すように、アンダースコア(_)を使用してインスタンスマネージャーの name プロパティを参照することにより、このスクリプトを記述することもできます。

    xfa.host.messageBox("The name of the subform using the instance manager name 
    property is: " + properties._Subform1.name +  
    ".\n\nNote: This value is different than the value returned by the name  
    property for the Subform1 object." , "Instance Manager Properties", 3);