pfc_searchcompare


pfcmain.pbl   >   pfc_u_tvs   >   pfc_searchcompare   

Full name pfc_u_tvs.pfc_searchcompare
Access public
Extend of boolean
Return value boolean
Prototype event boolean pfc_searchcompare(long,string,any,boolean,boolean)

Name Datatype
No Data

Name Datatype
ls_Source String
ls_Target String
ltvi_Item TreeViewItem

event pfc_searchcompare;//////////////////////////////////////////////////////////////////////////////
//
//	Event:  pfc_searchcompare
//
//	Arguments:
//	al_Handle			The handle of the item being compared.
//	as_Attribute		The attribute of the TreeView item to search ("Label", 
//								or "Data")
//	aa_Target			A variable of type Any containg the search target.
//	ab_RespectCase		True - search is case sensitive,
//							False - search is not case sensitive.  Only used if the target
//									is a string.
//	ab_FullCompare		True - Label or Data and Target must be equal,
//							False - Label or Data can contain Target (uses POS() function).
//									Only used if the target is a string.
//
//	Returns:		Boolean
//					True - a match was found
//					False - no match
//
//	Description:	This event is triggered by the of_SearchChild function (which is called
//						by of_FindItem).  It does the actual comparison between a TreeView
//						item and the target being searched for.
//
//						If a more complex comparison is desired, this event should be overridden.
//
//////////////////////////////////////////////////////////////////////////////
//	
//	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.
//
//////////////////////////////////////////////////////////////////////////////

String				ls_Target, ls_Source
TreeViewItem		ltvi_Item

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

If Lower(as_Attribute) = FIND_LABEL Then
	// Label Comparison
	If ab_RespectCase Then
		// Comparison is case-sensitive
		ls_Source = ltvi_Item.Label
		ls_Target = String(aa_Target)
	Else
		ls_Source = Upper(ltvi_Item.Label)
		ls_Target = Upper(String(aa_Target))
	End If

	If ab_FullCompare Then
		// Match whole words only
		If ls_Source = ls_Target Then Return True
	Else
		If Pos(ls_Source, ls_Target) > 0 Then Return True
	End If

Else
	// Data Comparison
	If ClassName(ltvi_Item.Data) = "string" Then
		// RespectCase and FullCompare boolean arguments are valid
		If ab_RespectCase Then
			// Comparison is case-sensitive
			ls_Source = String(ltvi_Item.Data)
			ls_Target = String(aa_Target)
		Else
			ls_Source = Upper(String(ltvi_Item.Data))
			ls_Target = Upper(String(aa_Target))
		End If

		If ab_FullCompare Then
			// Match whole words only
			If ls_Source = ls_Target Then Return True
		Else
			If Pos(ls_Source, ls_Target) > 0 Then Return True
		End If

	Else
		// Data is non-string
		If ltvi_Item.Data = aa_Target Then Return True
	End If
End If

Return False

end event

     
Name Owner
pfc_n_cst_tvsrv.of_searchchild pfc_n_cst_tvsrv

     
Name Owner
treeview.getitem treeview
systemfunctions.classname systemfunctions
systemfunctions.lower systemfunctions
systemfunctions.pos systemfunctions
systemfunctions.string systemfunctions
systemfunctions.upper systemfunctions

     
Full name
No Data

     
Name Scope
No Data