of_refreshitem


pfcmain.pbl   >   pfc_u_tv   >   of_refreshitem   

Full name pfc_u_tv.of_refreshitem
Access public
Extend of integer
Return value integer
Prototype public function integer of_refreshitem(long,long)

Name Datatype
No Data

Name Datatype
li_Index Integer
li_Limit Integer
ltvi_Item TreeViewItem

public function integer of_refreshitem (long al_handle, long al_row);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_RefreshItem
//
//	Access:  public
//
//	Arguments:
//	al_Handle						The handle of the item to be refreshed.
//	al_Row							The row of the DataStore pointing to the item.
//
//	Returns:		Integer
//					1	- the item was refreshed successfully
//					-1	- an error occurred
//
//	Description:	Refresh an item in the TreeView.  This includes removing
//						all its children (and discarding their rows from the DataStores)
//						and resetting its Label and Data attributes from the DataStore.
//
//						NOTE:  If the value of any of the key columns in the DataStore
//						have changed, this function MUST be used rather than
//						of_RefreshItem(al_Handle).  Because it would not be able to
//						find the proper row.  Get the row by calling of_GetDataRow
//						BEFORE it is changed.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
//	6.0.01	Change to return successful return code
//
//////////////////////////////////////////////////////////////////////////////
//
//	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_Index, li_Limit
TreeViewItem		ltvi_Item

If GetItem(al_Handle, ltvi_Item) = -1 Then Return -1

// Remove its child items
If ltvi_Item.Expanded Then
	CollapseItem(al_Handle)
	GetItem(al_Handle, ltvi_Item)
End If
If of_DiscardChildren(al_Handle) = -1 Then Return -1
	
// Determine proper element in the data source attribute class
li_Limit = UpperBound(inv_ds)
If ltvi_Item.Level > li_Limit Then
	li_Index = li_Limit
Else
	li_Index = ltvi_Item.Level
End If

// Reset the item's attributes
If of_SetItemAttributes(li_Index, inv_ds[li_Index].ds_obj, al_Row, ltvi_Item) = -1 Then Return -1

If SetItem(al_Handle, ltvi_Item) = -1 Then Return -1

Return 1

end function

     
Name Owner
pfc_u_tv.of_RefreshItem pfc_u_tv

     
Name Owner
treeview.collapseitem treeview
treeview.getitem treeview
treeview.setitem treeview
systemfunctions.upperbound systemfunctions
pfc_u_tv.of_DiscardChildren pfc_u_tv
pfc_u_tv.of_setitemattributes pfc_u_tv

     
Full name
No Data

     
Name Scope
No Data