of_discardchildren


pfcapsrv.pbl   >   pfc_n_cst_tvsrv_levelsource   >   of_discardchildren   

Full name pfc_n_cst_tvsrv_levelsource.of_discardchildren
Access public
Extend of integer
Return value integer
Prototype public function integer of_discardchildren(long)

Name Datatype
No Data

Name Datatype
ads_obj n_ds
li_level Integer
ll_Child Long
ll_Next Long
ll_Row Long
ltvi_Item TreeViewItem

public function integer of_discardchildren (long al_handle);//////////////////////////////////////////////////////////////////////////////
//
//	Function:	of_DiscardChildren
//
//	Access:		public
//
//	Arguments:
//	al_Handle	The handle of the item for which all child items will
//						be removed.
//
//	Returns:		Integer
//					 1	- the children were discarded successfully
//					-1	- an error occurred
//
//	Description:	Remove all the items from the TreeView below a specified item.
//						Discard the rows from DataStores.
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

Integer			li_level
Long				ll_Child, ll_Next, ll_Row
n_ds				ads_obj
TreeViewItem	ltvi_Item

// check reference variables
If IsNull(itv_requestor) or Not IsValid(itv_requestor) Then Return -1

ll_Child = itv_requestor.FindItem(ChildTreeItem!, al_Handle)
Do While ll_Child > 0

	// Recursively remove its child items
	If of_DiscardChildren(ll_Child) = -1 Then Return -1
	
	// find its row from the DataStore 
	If of_GetDataRow(ll_Child, ads_obj, ll_Row) = -1 Then Return -1
	
	// This will perform Discards on all Children rows of the Master row.
	If ads_obj.RowsDiscard(ll_Row, ll_Row, Primary!) < 1 Then Return -1
	
	// get the next child item handle
	ll_Next = itv_requestor.FindItem(NextTreeItem!, ll_Child)

	itv_requestor.DeleteItem(ll_Child)
	ll_Child = ll_Next
Loop

Return 1

end function

     
Name Owner
pfc_n_cst_tvsrv_levelsource.of_discardchildren pfc_n_cst_tvsrv_levelsource
pfc_n_cst_tvsrv_levelsource.pfc_refreshitem pfc_n_cst_tvsrv_levelsource

     
Name Owner
treeview.deleteitem treeview
treeview.finditem treeview
datastore.rowsdiscard datastore
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
pfc_n_cst_tvsrv_levelsource.of_getdatarow pfc_n_cst_tvsrv_levelsource
pfc_n_cst_tvsrv_levelsource.of_discardchildren pfc_n_cst_tvsrv_levelsource

     
Full name
No Data

     
Name Scope
No Data