Parameter.ReadOnly operator

説明

パラメータが読み込み専用かどうかを示す Boolean 値を設定したり、戻したりします。このフラグはおもにユーザインターフェイスに影響します。フラグを True に設定すると、プロパティページのパラメータが淡色表示されます。

プロパティページ(PPG)の読み取り専用パラメータはユーザインターフェイスからは変更できませんが、オブジェクトモデルを使用して変更できます(「Parameter.Value」を参照)。

ヒント:ReadOnly フラグを変更すると、パラメータの特定インスタンスのみに影響します。

注:このプロパティ設定はやり直しができません。読み取り専用の設定を変更し、取り消しできるようにする場合は、Parameter.SetCapabilityFlagを使用してください。

JScript の例

/*
        This example shows how to use Parameter.ReadOnly
*/
NewScene( null, false ) ;
var oProp = Application.ActiveSceneRoot.AddProperty( "CustomProperty",false,"Prop" ) ;
var oParam = oProp.AddParameter2( "ReadOnlyString", siString, null, null, null, 
                                        null, null, 0, siPersistable | siReadOnly ) ;
if ( !oParam.ReadOnly ) {
        Application.LogMessage( "Expected readonly" ) ;
}
// Another way to test the same thing
if ( !(oParam.Capabilities && siReadOnly) ) {
        Application.LogMessage( "Expected readonly" ) ; 
}
// You can still change the value from scripting,
// but the user would not be able to modify this from a PPG.
oParam.Value = "A string" ;     
//
// Show how the changing the read-only flag 
// only affects the specific instance
//
// Copy inside a null
var oNull = Application.ActiveSceneRoot.AddNull() ;
CopyPaste( oProp, null, oNull, 2 ) ;
// Remove the readonly flag on the copy
var oProp2 = oNull.Properties( "Prop" ) ;
oProp2.Parameters("ReadOnlyString").ReadOnly = false ;
// Demonstrate that the original pset parameter is still read-only.
if ( !oParam.ReadOnly ) {
        Application.LogMessage( "Expected still read-only" ) ;
}
// Show that the parameter is greyed out
InspectObj( oProp ) ;
// Expected result: <no messages are logged>

関連項目

siCapabilities Parameter.Capabilities Parameter.SetCapabilityFlag Parameter.Show Parameter.Value CustomProperty.AddParameter3