COMPOBJ( ) Function
Compares the properties of two objects and returns True (.T.) if their properties and property values are identical.
- oExpression1, oExpression2
- Specifies the objects to compare. oExpression1 and oExpression2 can be any expressions that evaluate to objects, such as object references, object variables, or object array elements.
COMPOBJ( ) returns False (.F.) if an object has a property that the other object doesn't have, or if the objects have identical properties but the values of one or more properties differ.
In the following example, two ListBoxes named
lstMyList2 and a ComboBox named
cmbMyCombo are created. The Name property of each ListBox is displayed.
COMPOBJ( ) is used to compare the properties of the first ListBox with the properties of the ComboBox. Because many of the properties are different, .F. is displayed. COMPOBJ( ) is then used to compare the properties of the first ListBox with the properties of the second ListBox. Because the Names properties are different, .F. is displayed. The second ListBox
lstMyList2 is replaced with the first ListBox
lstMyList1, and COMPOBJ( ) is used to compare the properties. Because their properties are identical, .T. is displayed.
lstMyList1 = CREATEOBJ('ListBox') && Creates a ListBox lstMyList2 = CREATEOBJ('ListBox') && Creates a second ListBox cmbMyCombo = CREATEOBJ('ComboBox') && Creates a ComboBox lstMyList1.Name = 'list1' lstMyList2.Name = 'list2' CLEAR ? lstMyList1.Name && Displays List1 Name property ? lstMyList2.Name && Displays List2 Name property ? COMPOBJ(lstMyList1, cmbMyCombo) && Displays .F. ? COMPOBJ(lstMyList1, lstMyList2) && Displays .F., different Names lstMyList2.Name = lstMyList1.Name ? COMPOBJ(lstMyList1, lstMyList2) && Displays .T., same properties