Parameter.ReadOnly operator

Description

Sets or returns a Boolean value indicating whether the parameter is read-only. This flag is primarily a user interface concept; if set to true, the parameter appears to be greyed out on the Property Page.

Although the value of a read-only parameter in the Property Page (PPG) cannot be changed through the user interface, it can be changed using the Object Model (see Parameter.Value).

Tip: Changing the ReadOnly flag only affects one particular instance of the parameter.

Note: Setting this property is not undoable. If you want to change the read-only capability and make it undoable, then use Parameter.SetCapabilityFlag.

Examples

JScript Example

/*
        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>

See Also

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