|
of_update
|
|
Full name
|
pfc_n_cst_luw.of_update
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_update(powerobject[],boolean,boolean)
|
Name
|
Datatype
|
la_rc
|
Any
|
lb_defined
|
Boolean
|
lds_nonpfc
|
DataStore
|
ldw_nonpfc
|
DataWindow
|
li_i
|
Integer
|
li_max
|
Integer
|
li_rc
|
Integer
|
lpo_tocheck
|
PowerObject
|
lpo_updaterequestor
|
PowerObject
|
ls_args
|
String[]
|
ltab_control
|
tab
|
luo_control
|
UserObject
|
lw_control
|
window
|
public function integer of_update (powerobject apo_control[], boolean ab_accepttext, boolean ab_resetflag);//////////////////////////////////////////////////////////////////////////////
//
// Function:
// of_Update
//
// Access: public
//
// Arguments:
// apo_control[] Array of controls that need to be updated
// ab_accepttext When applicable, specifying whether control should perform an
// AcceptText prior to performing the update:
// ab_resetflag Value specifying whether object should automatically
// reset its update flags.
//
// Returns: integer
// 1 = all updates successful
// -1 = At least one update failed
//
// Description:
// Updates the specified array of controls.
//
// Note:
// This function will update objects in the order in which they are found in
// the array. The linked datawindows are updated according to linkage service
// information.
//
// 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
PowerObject lpo_updaterequestor
UserObject luo_control
tab ltab_control
window lw_control
DataWindow ldw_nonpfc
DataStore lds_nonpfc
// If requested use the assist funtionality.
If ib_assist Then
of_Assist(is_instancename+'.of_Update('+of_GetClassNames(apo_control)+')')
End If
If UpperBound(apo_control) = 0 Then Return NO_ACTION
// Set up arguments for MetaClass calls.
ls_args = {'boolean', 'boolean', 'powerobject'}
// Determine the object to pass in as the requestor.
If IsValid(ipo_updaterequestor) Then
lpo_updaterequestor = ipo_updaterequestor
Else
lpo_updaterequestor = this
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_Update ( lw_control.control, ab_accepttext, ab_resetflag )
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_Update ( ltab_control.control, ab_accepttext, ab_resetflag )
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_Update ( luo_control.control, ab_accepttext, ab_resetflag )
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_Update", ls_args)
If lb_defined Then
li_rc = lpo_tocheck.Function Dynamic of_Update (ab_accepttext, ab_resetflag, lpo_updaterequestor)
If li_rc < 0 Then Return -1
Continue
End If
// Handle NonPFC DataWindows/DataStores.
If TypeOf (lpo_tocheck) = DataWindow! Then
ldw_nonpfc = lpo_tocheck
If ldw_nonpfc.Update (ab_accepttext, ab_resetflag) < 0 Then
// Visual notification is not displayed by PFC. Left up to the NonPFC
// object to process.
Return -1
End If
ElseIf TypeOf (lpo_tocheck) = DataStore! Then
lds_nonpfc = lpo_tocheck
If lds_nonpfc.Update (ab_accepttext, ab_resetflag) < 0 Then
// Visual notification is not displayed by PFC. Left up to the NonPFC
// object to process.
Return -1
End If
End If
Next
// All updates were successful.
Return 1
end function