|
of_removechildren
|
|
Full name
|
pfc_n_cst_tvsrv_levelsource.of_removechildren
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_removechildren(long)
|
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_removechildren (long al_handle);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_RemoveChildren
//
// Access: public
//
// Arguments:
// al_Handle The handle of the item for which all child items will
// be removed.
//
// Returns: Integer
// 1 - the children were removed successfully
// -1 - an error occurred
//
// Description: Remove all the items from the TreeView below a specified item.
// All appropriate rows will be removed from the 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_RemoveChildren(ll_Child) = -1 Then Return -1
// Discard its row from the DataStore and the item itself
If of_GetDataRow(ll_Child, ads_obj, ll_Row) = -1 Then Return -1
// parent level knows the style to remove the children
li_level = of_GetLevel(ll_child) - 1
If li_level < 1 Then Return -1
CHOOSE CASE inv_attrib[li_level].ii_deletestyle
Case DELETE_ROWS
// This will perform Deletes on all Children rows for the deleted Master row.
If ads_obj.DeleteRow(ll_Row) < 1 Then Return -1
Case DISCARD_ROWS
// This will perform Discards on all Children rows for the deleted Master row.
If ads_obj.RowsDiscard(ll_Row, ll_Row, Primary!) < 1 Then Return -1
End Choose
ll_Next = itv_requestor.FindItem(NextTreeItem!, ll_Child)
itv_requestor.DeleteItem(ll_Child)
ll_Child = ll_Next
Loop
Return 1
end function