pfc_undoedit


pfcapsrv.pbl   >   pfc_n_cst_tvsrv_levelsource   >   pfc_undoedit   

Full name pfc_n_cst_tvsrv_levelsource.pfc_undoedit
Access public
Extend of integer
Return value integer
Prototype event integer pfc_undoedit()

Name Datatype
No Data

Name Datatype
lds_DataStore n_ds
li_Index Integer
ll_Row Long
ll_undohandle Long
ls_undotext string
ltvi_Item TreeViewItem

event pfc_undoedit;call super::pfc_undoedit;//////////////////////////////////////////////////////////////////////////////
//
//	Event:		pfc_UndoEdit
//
//	Arguments:	None
//
//	Returns:		integer
//	 1 = success; last change was undone
//	 0 = nothing to undo
//	-1 = error
//
//	Description:	Change the label column in the appropriate DataStore to
//						be the prior label text.  This only works if the label column
//						is updatable.  If a computed column is being used for the
//						label, override this script with appropriate code.
//
//						NOTE:  Update() is NOT called for the DataStore.  This is
//						left to the user to perform.  If the label column is also part
//						of the key, or is used as a retrieval argument for any of its
//						children, this item should be refreshed with of_RefreshItem.
//
//////////////////////////////////////////////////////////////////////////////
//	
//	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_Index
Long					ll_Row, ll_undohandle
string				ls_undotext
n_ds					lds_DataStore
TreeViewItem		ltvi_Item

// check reference variables
If IsNull(itv_requestor) or Not IsValid(itv_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 something to undo
If il_UndoEditHandle < 1 Then Return 0

ll_undohandle = il_UndoEditHandle
ls_undotext = is_UndoEditLabelText
	
// reset the undo values here.  If an error occurs do not want undo hanging around
il_UndoEditHandle = 0
is_UndoEditLabelText = ""
is_UndoType = ""

if itv_requestor.GetItem(ll_undohandle, ltvi_Item) < 1 Then Return -1

// Get the row in the DataStore
If of_GetDataRow(ll_undohandle, lds_DataStore, ll_Row) = -1 Then
	Return -1
End If

// Get the label column for the level
li_Index = UpperBound(inv_attrib)
If ltvi_Item.Level < li_Index Then
	li_Index = ltvi_Item.Level
End If

// Change the value of the label column
lds_DataStore.SetItem(ll_Row, inv_attrib[li_Index].is_LabelColumn, ls_undotext)

// Reset the label on the treeivew item
ltvi_Item.Label = ls_undotext
If itv_requestor.SetItem(ll_undohandle, ltvi_item) < 1 Then Return -1

Return 1

end event

     
Name Owner
pfc_n_cst_tvsrv_levelsource.pfc_undo pfc_n_cst_tvsrv_levelsource

     
Name Owner
treeview.getitem treeview
treeview.setitem treeview
datastore.setitem datastore
systemfunctions.isnull systemfunctions
systemfunctions.isvalid systemfunctions
systemfunctions.upperbound systemfunctions
pfc_n_cst_tvsrv_levelsource.of_getdatarow pfc_n_cst_tvsrv_levelsource

     
Full name
No Data

     
Name Scope
No Data