|
pfc_endlabeledit
|
|
Full name
|
pfc_n_cst_tvsrv_levelsource.pfc_endlabeledit
|
Access
|
public
|
Extend of
|
long
|
Return value
|
long
|
Prototype
|
event long pfc_endlabeledit(long,string)
|
Name
|
Datatype
|
lds_obj
|
n_ds
|
li_Index
|
Integer
|
ll_Row
|
Long
|
ltvi_Item
|
TreeViewItem
|
event pfc_endlabeledit;//////////////////////////////////////////////////////////////////////////////
//
// Event: Pfc_EndLabelEdit
//
// Arguments:
// al_handle Handle of the treeview item being used
// as_newtext Text to become the new label of the treeview item
//
// Return: Long
// CONTINUE_ACTION Allow the new text to become the item's label
// PREVENT_ACTION Prevent the new text from becoming the item's label
//
// Description: Change the label column in the appropriate DataStore to
// be the new 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 pfc_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
n_ds lds_obj
TreeViewItem ltvi_Item
// check reference variables
If IsNull(itv_requestor) or Not IsValid(itv_requestor) Then Return -1
// check arguments
if itv_requestor.GetItem(al_handle, ltvi_Item) = FAILURE then
return PREVENT_ACTION
end if
// Make sure the label did change
If as_newtext = ltvi_Item.Label Then Return PREVENT_ACTION
// Get the row in the DataStore
If of_GetDataRow(al_handle, lds_obj, ll_Row) = FAILURE Then
Return PREVENT_ACTION
End If
// Get the label column for the level
li_Index = of_GetLevel(al_handle)
If li_index < 1 then Return PREVENT_ACTION
// Change the value of the label column
If lds_obj.SetItem(ll_Row, inv_attrib[li_Index].is_LabelColumn, as_newtext) < 1 Then Return PREVENT_ACTION
// set the undo values
if ib_undo then
il_UndoEditHandle = al_handle
is_UndoEditLabelText = ltvi_Item.Label
is_UndoType = UNDO_EDIT
End If
Return CONTINUE_ACTION
end event