of_accepttext


pfcapsrv.pbl   >   pfc_n_cst_luw   >   of_accepttext   

Full name pfc_n_cst_luw.of_accepttext
Access public
Extend of integer
Return value integer
Prototype public function integer of_accepttext(powerobject[],boolean)

Name Datatype
No Data

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
ls_args string[]
ls_errmessage string
ltab_control tab
luo_control UserObject
lw_control window

public function integer of_accepttext (powerobject apo_control[], boolean ab_focusonerror);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  
//	of_AcceptText
//
//	Access:  public
//
//	Arguments:
//	apo_control   Array of controls to check for accepttext
//	ab_focusonerror   Should focus be set to object in error
//
//	Returns:  integer
//	 1 = accepttext successful, no errors found
//	-1 = An error was found
//
//	Description:
//	Perform AcceptText functionality on all objects found on the specified 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
Boolean		lb_defined
string		ls_args[]
string		ls_errmessage
powerobject	lpo_tocheck
DataWindow	ldw_nonpfc
DataStore	lds_nonpfc
UserObject	luo_control
tab			ltab_control
window		lw_control

// If requested use the assist funtionality.
If ib_assist Then 
	of_Assist(is_instancename+'.of_AcceptText('+of_GetClassNames(apo_control)+')')
End If

// Set up arguments for MetaClass calls.
ls_args[1] = 'boolean'

// 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_AcceptText ( lw_control.control, ab_FocusOnError ) 
				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_AcceptText ( ltab_control.control, ab_FocusOnError ) 
				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_AcceptText ( luo_control.control, ab_FocusOnError ) 
				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_AcceptText", ls_args)
	If lb_defined Then
		li_rc = lpo_tocheck.Function Dynamic of_AcceptText (ab_focusonerror)
		If li_rc < 0 Then Return -1
		Continue		
	End If
	
	// Handle NonPFC DataWindows/DataStores.
	If TypeOf (lpo_tocheck) = DataWindow! Then
		ldw_nonpfc = lpo_tocheck
		// Do not perform AcceptText on Datawidows found on uncreated tab pages.				
		If ldw_nonpfc.RowCount() + ldw_nonpfc.FilteredCount() + &
			ldw_nonpfc.ModifiedCount() + ldw_nonpfc.DeletedCount() > 0 Then						
			// Perform AcceptText functionality.
			la_rc = ldw_nonpfc.AcceptText()
			If la_rc < 0 Then 
				If ab_FocusOnError Then ldw_nonpfc.SetFocus()
				Return -1
			End If
		End If
	ElseIf TypeOf (lpo_tocheck) = DataStore! Then
		lds_nonpfc = lpo_tocheck
		// Do not perform AcceptText on Datawidows found on uncreated tab pages.				
		If lds_nonpfc.RowCount() + lds_nonpfc.FilteredCount() + &
			lds_nonpfc.ModifiedCount() + lds_nonpfc.DeletedCount() > 0 Then						
			// Perform AcceptText functionality.
			la_rc = lds_nonpfc.AcceptText()
			If la_rc < 0 Then
				// DataStore AcceptText() does not give visual notification on error.
				ls_errmessage = "Failed AcceptText validation on datastore.  "+&
							 "Column "+ lds_nonpfc.GetColumnName() + &
							 " on row "+ string(lds_nonpfc.GetRow()) + "."
				of_Messagebox ('pfc_luw_dsaccepttextfailed','AcceptText', &
					ls_errmessage, Exclamation!, Ok!, 1)
				Return -1
			End If
		End If
	End If
		
Next

// All AcceptText were successful
Return 1

end function

     
Name Owner
pfc_n_cst_luw.of_save pfc_n_cst_luw
pfc_n_cst_luw.of_accepttext pfc_n_cst_luw
pfc_u_lvs.pfc_accepttext pfc_u_lvs
pfc_u_tab.pfc_accepttext pfc_u_tab
pfc_u_tvs.pfc_accepttext pfc_u_tvs
pfc_w_master.pfc_accepttext pfc_w_master
pfc_u_base.pfc_accepttext pfc_u_base

     
Name Owner
powerobject.typeof powerobject
dragobject.setfocus dragobject
datawindow.accepttext datawindow
datawindow.deletedcount datawindow
datawindow.filteredcount datawindow
datawindow.modifiedcount datawindow
datawindow.rowcount datawindow
datastore.accepttext datastore
datastore.deletedcount datastore
datastore.filteredcount datastore
datastore.getcolumnname datastore
datastore.getrow datastore
datastore.modifiedcount datastore
datastore.rowcount datastore
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.len systemfunctions
systemfunctions.pos systemfunctions
systemfunctions.string systemfunctions
systemfunctions.upperbound systemfunctions
pfc_n_cst_metaclass.of_isfunctiondefined pfc_n_cst_metaclass
pfc_n_cst_luw.of_getclassnames pfc_n_cst_luw
pfc_n_cst_luw.of_assist pfc_n_cst_luw
pfc_n_cst_luw.of_isselfupdatingobject pfc_n_cst_luw
pfc_n_cst_luw.of_accepttext pfc_n_cst_luw
pfc_n_cst_luw.of_gettype pfc_n_cst_luw
pfc_n_base.of_messagebox pfc_n_base

     
Full name
No Data

     
Name Scope
No Data