Enabled, Locked Properties Example
The following example demonstrates the Enabled and Locked properties and how they complement each other. This example exposes each property independently with a CheckBox, so you observe the settings individually and combined. This example also includes a second TextBox so you can copy and paste information between the TextBox controls and verify the activities supported by the settings of these properties.
Note You can copy the selection to the Clipboard using CTRL+C and paste using CTRL+V.
To use this example, copy this sample code to the Script Editor of a form. Make sure that the form contains:
Dim TextBox1
Dim TextBox2
Dim CheckBox1
Dim CheckBox2
Sub CheckBox1_Click()
TextBox2.Text = "TextBox2"
TextBox1.Enabled = CheckBox1.Value
End Sub
Sub CheckBox2_Click()
TextBox2.Text = "TextBox2"
TextBox1.Locked = CheckBox2.Value
End Sub
Sub Item_Open()
Set TextBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox1")
Set TextBox2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("TextBox2")
Set CheckBox1 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CheckBox1")
Set CheckBox2 = Item.GetInspector.ModifiedFormPages.Item("P.2").Controls("CheckBox2")
TextBox1.Text = "TextBox1"
TextBox1.Enabled = True
TextBox1.Locked = False
CheckBox1.Caption = "Enabled"
CheckBox1.Value = True
CheckBox2.Caption = "Locked"
CheckBox2.Value = False
TextBox2.Text = "TextBox2"
End Sub