|
of_deleteitem
|
|
Full name
|
pfc_u_tv.of_deleteitem
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
public function integer of_deleteitem(long)
|
Name
|
Datatype
|
li_Index
|
Integer
|
li_Limit
|
Integer
|
ll_Row
|
Long
|
ltvi_Item
|
TreeViewItem
|
public function integer of_deleteitem (long al_handle);//////////////////////////////////////////////////////////////////////////////
//
// Function: of_DeleteItem
//
// Access: public
//
// Arguments:
// al_Handle The handle of the item to be delete.
//
// Returns: Integer
// 1 - the item was deleted successfully
// -1 - an error occurred
//
// Description: Delete an item from the TreeView. The item's row will be
// DELETED from its DataStore (the user must call the Update(),
// however). All its children will be removed and their rows
// DISCARDED from their DataStores. Refrential integrity is left
// to the user.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
// 7.0 Changed the li_row datatype to long (ll_row).
//
//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1996-1999 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_Index, li_Limit
Long ll_Row
TreeViewItem ltvi_Item
If GetItem(al_Handle, ltvi_Item) = -1 Then Return -1
// Determine proper element in the data source attribute class
li_Limit = UpperBound(inv_ds)
If ltvi_Item.Level > li_Limit Then
li_Index = li_Limit
Else
li_Index = ltvi_Item.Level
End If
// Discard the item's children
If of_DiscardChildren(al_Handle) = -1 Then Return -1
// Get the row in the DataStore for this item
ll_Row = inv_ds[li_Index].ds_obj.Find("pfc_tvi_key = '" + String(ltvi_Item.Data) + "'", &
1, inv_ds[li_Index].ds_obj.RowCount())
If ll_Row < 1 Then Return -1
// Delete the row
inv_ds[li_Index].ds_obj.DeleteRow(ll_Row)
Return DeleteItem(al_Handle)
end function
Name
|
Owner
|
treeview.deleteitem |
treeview
|
treeview.getitem |
treeview
|
datastore.deleterow |
datastore
|
datastore.find |
datastore
|
datastore.rowcount |
datastore
|
systemfunctions.string |
systemfunctions
|
systemfunctions.upperbound |
systemfunctions
|
pfc_u_tv.of_DiscardChildren |
pfc_u_tv
|