of_DeleteItem


pfcapsrv.pbl   >   pfc_n_cst_lvsrv_datasource   >   of_DeleteItem   

Full name pfc_n_cst_lvsrv_datasource.of_DeleteItem
Access public
Extend of integer
Return value integer
Prototype public function integer of_DeleteItem()

Name Datatype
No Data

Name Datatype
li_confirm integer
li_deletecount integer
li_selected integer
li_totalitems integer

public function integer of_DeleteItem ();//////////////////////////////////////////////////////////////////////////////
//	Public Function:	of_DeleteItem
//	Arguments:		None
//	Returns:			Integer
//					 	1	- the item was deleted successfully
//					 	0 - nothing deleted (or was prevented)
//						-1	- an error occurred
//	Description:	Delete an item(s) from the listview.  The item's row will be
//						DELETED from its DataStore (the user must call the Update(), however).  
//////////////////////////////////////////////////////////////////////////////
//	Rev. History:	Version
//						6.0   Initial version
//////////////////////////////////////////////////////////////////////////////
//	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_totalitems, li_selected, li_confirm
integer	li_deletecount=0

// check reference variables
if IsNull(ilv_requestor) or not IsValid(ilv_requestor) then return -1

li_totalitems = ilv_requestor.TotalSelected()
if li_totalitems < 1 then return 0

// confirm this action
if of_ConfirmOnDelete() then
	if li_totalitems = 1 then
		li_confirm = of_ConfirmDelete(1)
		// Delete item if = 1
		if li_confirm <> 1 then return 0
	else
		// we have multiple deletions, so check to see if we have asked the question before
		li_confirm = of_ConfirmDelete( li_totalitems )
		// Delete item if = 1
		if li_confirm <> 1 then return 0
	end if
end if

// find the first selected item
li_selected = ilv_requestor.SelectedIndex()

//Loop and delete the selected items.
do while li_selected > 0
	ilv_requestor.event pfc_PreDeleteItem(li_selected)
	if this.of_DeleteItem(li_selected) < 0 then return -1
	li_deletecount++

	// Get handle to next selected item - when an item is deleted, listview count is reset
	// so we have to start from the top again
	li_selected = of_FindSelected(0, Directiondown!)
loop

return li_deletecount
end function

     
Name Owner
pfc_n_cst_lvsrv_datasource.pfc_deleteitem pfc_n_cst_lvsrv_datasource

     
Name Owner
listview.selectedindex listview
listview.totalselected listview
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
pfc_n_cst_lvsrv.of_findselected pfc_n_cst_lvsrv
pfc_n_cst_lvsrv_datasource.of_ConfirmDelete pfc_n_cst_lvsrv_datasource
pfc_n_cst_lvsrv_datasource.of_ConfirmOnDelete pfc_n_cst_lvsrv_datasource
pfc_n_cst_lvsrv_datasource.of_DeleteItem pfc_n_cst_lvsrv_datasource
pfc_u_lvs.pfc_predeleteitem pfc_u_lvs

     
Full name
No Data

     
Name Scope
No Data