4. System Classes : CompositeField Class : IsAncestorOf Method
 
Share this page                  
IsAncestorOf Method
The IsAncestorOf method returns TRUE if the composite is an ancestor, at any level, of a specified form field.
This method has the following syntax:
smallint = CompositeField.IsAncestorOf(descendant = FormField)
This method has the following parameter:
descendant
Specifies the form field
This method determines if a specific field is part of a particular composite field. This method is most useful in generalized ChildExit events to see if the field being exited is part of a given composite field. For example, in a ChildExit event block for SubForm, sf, you can use the following expressions to determine if the user is leaving the subform:
if field(sf).IsAncestorOf(descendant =
CurFrame.TargetField) = TRUE then
/*... (user is NOT leaving subform sf) ...*/
endif;
This code returns FALSE if it is not part of the composite.
Note:  OpenROAD considers a field to be an ancestor of itself.
IsDescendantOf (see IsDescendantOf Method), a related method defined for the FieldObject class, determines if a field is a descendant of a specified field.