|
pfc_undodelete
|
|
Full name
|
pfc_n_cst_lvsrv_datasource.pfc_undodelete
|
Access
|
public
|
Extend of
|
integer
|
Return value
|
integer
|
Prototype
|
event integer pfc_undodelete()
|
Name
|
Datatype
|
li_cnt
|
integer
|
li_numbertoundo
|
integer
|
li_rc
|
integer
|
ll_cnt
|
long
|
ll_deleterowid
|
long
|
ll_emptyhandle
|
long[]
|
ll_numbertoundo
|
long
|
ll_row
|
long
|
ll_rowcount
|
long
|
ll_undohandle
|
long
|
llvi_empty
|
listviewitem
|
llvi_emptyitem
|
listviewitem[]
|
llvi_undo
|
listviewitem
|
ls_key
|
string
|
ls_undokey
|
string
|
event pfc_UndoDelete;//////////////////////////////////////////////////////////////////////////////
// Event: pfc_UndoDelete
// Arguments: None
// Returns: integer
// 1 = success; last delete was undone
// 0 = nothing to undo
// -1 = error
// Description: Restore the last deleted item (items if multiple delete occured)
// back to the listview
//////////////////////////////////////////////////////////////////////////////
// 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_rc, li_numbertoundo, li_cnt
long ll_row, ll_rowcount, ll_undohandle, ll_deleterowid
long ll_emptyhandle[], ll_numbertoundo, ll_cnt
string ls_key, ls_undokey
listviewitem llvi_undo
listviewitem llvi_empty, llvi_emptyitem[]
// Check reference variables
if IsNull(ilv_requestor) or not IsValid(ilv_requestor) then return -1
// Do not undo if undo is not set
if not ib_Undo then return -1
// Check to see if we have an delete to undo
li_numbertoundo = UpperBound(il_UndoDeleteHandle)
if li_numbertoundo < 1 then return 0
//ilv_requestor.SetRedraw(false)
for li_cnt = li_numbertoundo to 1 step -1
ll_undohandle = il_UndoDeleteHandle[li_cnt]
// ls_undokey = string( ilvi_UndoDeleteItem[ll_cnt].Data )
llvi_undo = ilvi_UndoDeleteItem[li_cnt]
// Reset the undo delete variables (here if there are problems so we don't try to undelete the wrong thing)
il_UndoDeleteHandle[li_cnt] = 0
ilvi_UndoDeleteItem[li_cnt] = llvi_empty
// The last row in the DataStore Delete! buffer is the one last deleted.
ll_row = inv_Attrib.ids_Source.DeletedCount()
if ll_row < 1 then return -1
// Compare the keys to see if we really have the right row
ls_undokey = of_DecodeKey(String(llvi_undo.Data))
ll_deleterowid = inv_Attrib.ids_Source.GetRowFromRowid(Long(ls_undokey), Delete!)
if ll_deleterowid > 0 then
// Move row back to primary buffer
ll_rowcount = inv_Attrib.ids_Source.RowCount()
inv_Attrib.ids_Source.RowsMove(ll_deleterowid, ll_deleterowid, Delete!, inv_Attrib.ids_Source, (ll_rowcount + 1), Primary!)
else
continue
end if
// Insert row back under parent.
llvi_undo.Selected = false
li_rc = ilv_requestor.InsertItem(ll_undohandle, llvi_undo)
il_UndoInsertHandle = ll_undohandle
if li_rc < 0 then return -1
end for
// Reset the undo delete variables for upperbound check
il_UndoDeleteHandle = ll_emptyhandle
ilvi_UndoDeleteItem = llvi_emptyitem
is_UndoType = ""
//ilv_requestor.SetRedraw(true)
return 1
end event
Name
|
Owner
|
listview.insertitem |
listview
|
datastore.deletedcount |
datastore
|
datastore.getrowfromrowid |
datastore
|
datastore.rowcount |
datastore
|
datastore.rowsmove |
datastore
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.long |
systemfunctions
|
systemfunctions.string |
systemfunctions
|
systemfunctions.upperbound |
systemfunctions
|
pfc_n_cst_lvsrv_datasource.of_DecodeKey |
pfc_n_cst_lvsrv_datasource
|