of_findfirstitemlevel


pfcmain.pbl   >   pfc_u_tv   >   of_findfirstitemlevel   

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

Name Datatype
No Data

Name Datatype
la_find any
li_idx Integer
li_items Integer
ll_Found Long
ll_Handle Long
ltvi_Item TreeViewItem

public function long of_findfirstitemlevel (integer ai_level, long al_handle);//////////////////////////////////////////////////////////////////////////////
//
//	Function:  of_FindFirstItemLevel
//
//	Access:  public
//
//	Arguments:
//	ai_Level					The Level of the TreeView for which the first item is
//									being sought.
//	al_Handle					The handle of the TreeView item to begin searching
//
//	Returns:		Long
//					The handle of the first item on the given level.  Returns 0 if not found,
//					-1 if an error occurrs.
//
//	Description:	Find the first item on a level.
//
//////////////////////////////////////////////////////////////////////////////
//
//	Revision History
//
//	Version
//	5.0   Initial version
//	6.0.01	Rewrite to be non-recursive to avoid stack overflow errors.  Use a queue 
//				to simulate recursion in a level centered traversal
//
//////////////////////////////////////////////////////////////////////////////
//
//	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.
//
//////////////////////////////////////////////////////////////////////////////

Long					ll_Handle, ll_Found
Integer				li_items, li_idx
TreeViewItem		ltvi_Item
any					la_find

// do not have this string as your label
la_find = "0987654321FIRSTitemonlevel1234567890)(*&^%$#@!~~"

// populate the queue - very restrictive search
this.of_finditem("label", la_find, al_handle, ai_level, True, True)

li_items = upperbound(il_queue)
For li_idx = 1 to li_items
	If this.GetItem(il_queue[li_idx], ltvi_item) = -1 Then Return -1
	// the queue is in level order.  The first item we match level with is the first
	// item for the level
	If ai_level = ltvi_item.level Then
		Return il_queue[li_idx]
	End If
Next

Return 0

end function

     
Name Owner
pfc_u_tv.of_refreshlevel pfc_u_tv

     
Name Owner
treeview.getitem treeview
systemfunctions.upperbound systemfunctions
pfc_u_tv.of_finditem pfc_u_tv

     
Full name
No Data

     
Name Scope
No Data