|
pfc_insertitem
|
|
Full name
|
pfc_u_tvs.pfc_insertitem
|
Access
|
public
|
Extend of
|
long
|
Return value
|
long
|
Prototype
|
event long pfc_insertitem(long,n_ds,long,string,long)
|
Name
|
Datatype
|
ltvi_new
|
treeviewitem
|
event pfc_insertitem;//////////////////////////////////////////////////////////////////////////////
//
// Event: pfc_InsertItem
//
// Arguments:
// al_parent The handle to the Treeview item to place retrieved data under
// ads_source The DataStore containing the data to be used for the new item.
// This can be the same DataStore that was created for the treeview, or
// another maintained by the user. If the latter, the row will be added
// to the treeviews DataStore.
// al_Row The row in the DataStore pointing to the data.
// as_Position The position under the parent where the new item will be inserted:
// "First" - before the first child of the parent
// "Last" - after the last child (default)
// "Sort" - in the sorted position based on the item's label
// "After" - after the item with handle al_handle
// al_handle The handle to the item after which the new item will be inserted.
// Ignored unless as_Position = "After".
//
// Returns: long
// handle of item added successfully
// -1 = an error occurred
//
// Description: Set the item attributes and place into the treeview.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
treeviewitem ltvi_new
// Check Arguments
If IsNull(al_parent) or IsNull(al_row) or IsNull(al_handle) or &
(al_parent < 0) or (al_row < 1) or (al_handle < 0) or &
IsNull(as_position) or (Trim(as_position) = "") or &
IsNull(ads_source) or Not IsValid(ads_source) Then
Return -1
End If
Choose Case lower(as_position)
Case INSERT_FIRST, INSERT_LAST, INSERT_SORT, INSERT_AFTER
// valid insert type
Case Else
Return -1
End Choose
// popuate the new item with data
this.event pfc_SetItemAttributes(al_parent, ads_source, al_row, ltvi_new)
// preform pre insert logic
this.event pfc_PreInsertItem(al_parent, ads_source, al_row, ltvi_new)
// add the item to the listview
If isvalid(inv_levelsource) then
Return inv_levelsource.event pfc_insertitem(al_parent, ads_source, al_row, ltvi_new, as_position, al_handle)
else
Choose Case Lower(as_Position)
Case INSERT_LAST
Return this.InsertItemLast(al_Parent, ltvi_new)
Case INSERT_SORT
Return this.InsertItemSort(al_Parent, ltvi_new)
Case INSERT_AFTER
Return this.InsertItem(al_Parent, al_handle, ltvi_new)
Case INSERT_FIRST
Return this.InsertItemFirst(al_Parent, ltvi_new)
End Choose
End If
Return -1
end event