Click or drag to resize

CompObj Function

X#
-- todo --
Compares the properties of two objects and returns True (.T.) if their properties and property values are identical.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION CompObj(
	oExpression1,
	oExpression2
) AS USUAL CLIPPER
Request Example View Source

Parameters

oExpression1 (Optional)
Type: Usual
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.
oExpression2 (Optional)
Type: Usual
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.

Return Value

Type: Usual
Logical
Remarks
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.
Examples
X#
 1lstMyList1 = CreateOBJ('ListBox')  // Creates a ListBox
 2lstMyList2 = CreateOBJ('ListBox')  // Creates a second ListBox
 3cmbMyCombo = CreateOBJ('ComboBox')  // Creates a ComboBox
 4lstMyList1.Name = 'list1'
 5lstMyList2.Name = 'list2'
 6Clear
 7? lstMyList1.Name  // Displays List1 Name property
 8? lstMyList2.Name  // Displays List2 Name property
 9? CompObj(lstMyList1, cmbMyCombo)     // Displays .F.
10? CompObj(lstMyList1, lstMyList2)     // Displays .F., different Names
11lstMyList2.Name = lstMyList1.Name
12? CompObj(lstMyList1, lstMyList2)     // Displays .T., same properties
See Also