|
pfc_insertitem
|
|
Full name
|
pfc_u_lvs.pfc_insertitem
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
event integer pfc_insertitem(n_ds,long,string,integer)
|
Name
|
Datatype
|
llvi_new
|
listviewitem
|
event pfc_insertitem;//////////////////////////////////////////////////////////////////////////////
//
// Event: pfc_InsertItem
//
// Arguments:
// 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 listview, or
// another maintained by the user. If the latter, the row will be added
// to the listviews DataStore. Passed by reference.
// 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 item of the listview
// "Last" - after the last listview item (default)
// "Before" - before the item with index al_Item
// "After" - after the item with index al_Item
// al_Item The index to the item which the new item will be inserted either after or before.
// Ignored unless as_Position = "After" or "Before".
//
// Returns: integer
// index of item added successfully
// -1 = an error occurred
//
// Description: Set the item attributes and place into the listview.
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
listviewitem llvi_new
// check arguments
if IsNull(ads_source) or not isvalid(ads_source) Then Return -1
If IsNull(as_position) or (trim(as_position) = "") Then return -1
if IsNull(ai_index) or (ai_index < 0) then return -1
If IsNull(al_row) or (al_row = 0) then return -1
// popuate the new item with data
this.event pfc_SetItemAttributes(ads_source, al_row, llvi_new)
// preform pre insert logic
this.event pfc_preinsertitem(ads_source, al_row, llvi_new)
// add the item to the listview
If isvalid(inv_datasource) then
Return inv_datasource.event pfc_insertitem(ads_source, al_row, llvi_new, as_position, ai_index)
Else
Return this.AddItem(llvi_new)
End If
Return -1
end event