|
of_validation
|
|
Full name
|
pfc_n_cst_luw.of_validation
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_validation(powerobject[])
|
Name
|
Datatype
|
la_rc
|
Any
|
lb_defined
|
Boolean
|
ldw_nonpfc
|
DataWindow
|
li_i
|
Integer
|
li_max
|
Integer
|
li_rc
|
Integer
|
lpo_tocheck
|
PowerObject
|
ls_args
|
String[]
|
ltab_control
|
Tab
|
luo_control
|
UserObject
|
lw_control
|
Window
|
public function integer of_validation (powerobject apo_control[]);//////////////////////////////////////////////////////////////////////////////
//
// Function:
// of_validation
//
// Access: public
//
// Arguments:
// apo_control Array of controls that need validation.
//
// Returns: integer
// 1 = success (no errors found)
// -1 = An error was found during validation
//
// Description:
// Perform validation in each object for specified powerobject array.
//
// Note:
// This function is called recursively to handle tab controls and user objects.
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 6.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1997 Sybase, Inc. and its subsidiaries. All rights reserved.
// Any distribution of the PowerBuilder Foundation Classes (PFC)
// source code by other than Sybase, Inc. and its subsidiaries is prohibited.
//
//////////////////////////////////////////////////////////////////////////////
Any la_rc
Integer li_max
Integer li_i
Integer li_rc
String ls_args[]
Boolean lb_defined
PowerObject lpo_tocheck
UserObject luo_control
Tab ltab_control
Window lw_control
DataWindow ldw_nonpfc
// If requested use the assist funtionality.
If ib_assist Then
of_Assist(is_instancename+'.of_Validation('+of_GetClassNames(apo_control)+')')
End If
// Loop thru all the objects
li_max = UpperBound (apo_control)
For li_i = 1 to li_max
lpo_tocheck = apo_control[li_i]
If IsNull(lpo_tocheck) or Not IsValid(lpo_tocheck) Then Continue
Choose Case TypeOf ( lpo_tocheck )
// Windows!, Tabs!, and UserObjects! can either be SelfUpdatingObjects (SUO) or
// they can be controls which may be holding SelfUpdatingObjects.
// If they are found to be SUO then they will treated as such, if not their
// respective control array will be traversed in search of other SUOs.
Case Window!
If Not of_IsSelfUpdatingObject (lpo_tocheck) Then
// Test for Window Controls (which may contain SelfUpdatingObjects)
lw_control = lpo_tocheck
li_rc = This.of_validation ( lw_control.control )
If li_rc < 0 Then Return -1
Continue
End If
Case Tab!
If Not of_IsSelfUpdatingObject (lpo_tocheck) Then
// Test for Tab Controls (which contain TabPages which may contain SelfUpdatingObjects)
ltab_control = lpo_tocheck
li_rc = This.of_validation ( ltab_control.control )
If li_rc < 0 Then Return -1
Continue
End If
Case UserObject!
If Not of_IsSelfUpdatingObject (lpo_tocheck) Then
// Test for UserObjects (which may contain SelfUpdatingObjects)
luo_control = lpo_tocheck
li_rc = This.of_validation ( luo_control.control )
If li_rc < 0 Then Return -1
Continue
End If
End Choose
// -- An object which 'may' be a SUO has been encountered. --
// Determine if the SUO type is one the service has been asked to process.
If Len (is_typetoprocess) > 0 Then
If Pos (is_typetoprocess, of_GetType(lpo_tocheck)) = 0 Then
// Not a SUO type the service has been asked to process.
Continue
End If
End If
// Check/Perform for SelfUpdatingObject Functionality
lb_defined = inv_metaclass.of_isFunctionDefined &
(lpo_tocheck.ClassDefinition, "of_Validation", ls_args)
If lb_defined Then
li_rc = lpo_tocheck.Function Dynamic of_Validation ()
If li_rc < 0 Then Return -1
Continue
End If
// Handle NonPFC DataWindows/DataStores.
If TypeOf (lpo_tocheck) = DataWindow! or TypeOf (lpo_tocheck) = DataStore! Then
la_rc = lpo_tocheck.Event Dynamic ue_validation ()
If ClassName(la_rc) = 'integer' or ClassName(la_rc)='long' Then
// Functionality was found.
If la_rc < 0 Then Return -1
End If
End If
Next
// All validation was successful
Return 1
end function