JavaScript Editor js editor     Web development 

Main Page

You can set the properties of an object at run time or design time.

Specifying the Default Value for a Property

You can set any of the base class properties in the Class Designer. When an object based on the class is added to the form, the object reflects your property settings rather than the Visual FoxPro base class property settings.

Properties in subclasses inherit the default property values that you specify unless you choose Reset to Default on the shortcut menu for the property, which resets the default values to those of the parent class.

To set a property

  • Use the following syntax to set an object property programmatically:

    Container.Object.Property = Value

    For example, the following statements set various properties of a text box named txtDate on a form named frmPhoneLog:

    В Copy Code
    frmPhoneLog.txtDate.Value = DATE( ) && Display the current date  
    frmPhoneLog.txtDate.Enabled = .T. && The control is enabled  
    frmPhoneLog.txtDate.ForeColor = RGB(0,0,0)    && black text  
    frmPhoneLog.txtDate.BackColor = RGB(192,192,192)  && gray background  

For the property settings in the preceding examples, frmPhoneLog is the highest-level container object. If frmPhoneLog were contained in a form set, you would also need to include the form set in the parent path:

В Copy Code
frsContacts.frmPhoneLog.txtDate.Value = DATE( )

To set multiple properties

For example, to set multiple properties of a column in a grid in a form in a form set, you could use the following syntax:

В Copy Code
WITH THISFORMSET.frmForm1.grdGrid1.grcColumn1
 .Width = 5
 .Resizable = .F.
 .ForeColor = RGB(0,0,0)
 .BackColor = RGB(255,255,255)
 .SelectOnEntry = .T.
You can also modify an object's properties in the Properties Window (Visual FoxPro).

See Also

JavaScript Editor js editor     Web development