of_insertitem


pfcmain.pbl   >   pfc_u_lvs   >   of_insertitem   

Full name pfc_u_lvs.of_insertitem
Access public
Extend of integer
Return value integer
Prototype public function integer of_insertitem(any[],string,integer)

Name Datatype
No Data

Name Datatype
lds_datastore n_ds
li_newindex integer
ll_row long

public function integer of_insertitem (any aa_columnvalues[], string as_position, integer ai_index);//////////////////////////////////////////////////////////////////////////////
//
//	Function:	of_InsertItem
//
//	Access:		public
//
//	Arguments:
//	aa_ColumnValues[]	The array containing the data to be used for the new item.
//	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
//	ai_index				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
//					Returns the index of the item if it was added successfully, 
//					-1 if an error occurrs.
//
//	Description:	Add a new item to the ListView using a inserted row.  The row does
//						not have to be added to the datastore first using this method.  Pass
//						the row in with the aa_columnvalues array.
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////
long					ll_row
integer				li_newindex
n_ds					lds_datastore

// check arguments
if upperbound(aa_columnvalues) < 1 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

// Create the storage datastore
lds_datastore = create n_ds

If isvalid(inv_datasource) then
	If inv_datasource.of_ConvertToRow(aa_columnvalues, lds_datastore, ll_row) <> 1 Then
		Destroy lds_datastore
		Return -1
	End If
Else
	Return -1
End If

// Add the item to the listview
li_newindex = this.event pfc_insertitem(lds_datastore, ll_row, as_position, ai_index)

Destroy lds_datastore

return li_newindex
end function

     
Name Owner
pfc_u_lvs.of_insertitem pfc_u_lvs

     
Name Owner
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.trim systemfunctions
systemfunctions.upperbound systemfunctions
pfc_n_cst_lvsrv_datasource.of_ConvertToRow pfc_n_cst_lvsrv_datasource
pfc_u_lvs.pfc_insertitem pfc_u_lvs

     
Full name
No Data

     
Name Scope
No Data