|
pfc_deleteitem
|
|
Full name
|
pfc_u_lvs.pfc_deleteitem
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
event integer pfc_deleteitem()
|
Name
|
Datatype
|
li_counter
|
Integer
|
li_selected
|
Integer
|
event pfc_deleteitem;//////////////////////////////////////////////////////////////////////////////
//
// Event: pfc_deleteItem
//
// Arguments: none
//
// Returns: Integer
// # of items deleted successfuliy
// 0 - no item was deleted
// -1 = error
//
// Description:
// Deletes the selected row(s) of the listview and syncs the datastore
//
//////////////////////////////////////////////////////////////////////////////
//
// 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.
//
//////////////////////////////////////////////////////////////////////////////
Integer li_selected, li_counter=0
// Use the service if it is on
If isvalid(inv_datasource) Then
Return inv_datasource.event pfc_deleteitem()
End If
// only perform delete if we have items selected
If this.TotalSelected() < 1 Then Return NO_ACTION
// find the first selected item
li_selected = this.SelectedIndex()
//Loop and delete the selected items.
DO WHILE li_selected > 0
this.event pfc_predeleteitem(li_selected)
this.Deleteitem(li_selected)
li_counter++
// 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 = this.FindItem(0, Directiondown!, False, True, False, False)
LOOP
Return li_counter
end event