cbneditchange


pfcmain.pbl   >   pfc_u_ddlb   >   cbneditchange   

Full name pfc_u_ddlb.cbneditchange
Access public
Extend of
Return value
Prototype event cbneditchange()

Name Datatype
No Data

Name Datatype
lb_keyback boolean
lb_keydel boolean
li_searchindex integer
li_searchtextlen integer
ls_foundtext string
ls_searchtext string

event cbneditchange;//////////////////////////////////////////////////////////////////////////////
//
//	Event: 			cbneditchange
//
//	Description:	Search the ddlb for the text entered. 
//						(Provides Type ahead features.)
//
//////////////////////////////////////////////////////////////////////////////
//	
//	Revision History
//
//	Version
//	5.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_searchtextlen
integer	li_searchindex
string	ls_searchtext
string	ls_foundtext
boolean	lb_keyback
boolean	lb_keydel

// Check search flag.
if not ib_search then return

// Store "Key" keystrokes.
lb_keyback = KeyDown(KeyBack!)
lb_keydel = KeyDown(KeyDelete!)

// Get current text
ls_searchtext = this.text
li_searchtextlen = Len (ls_searchtext)

// If there is nothing to search or the user performed a delete or backspace operation,
//	do not perform the search.
If li_searchtextlen <=0 Or lb_keyback Or lb_keydel Then Return

// Find the text.
li_searchindex = this.FindItem (ls_searchtext, 0)
if li_searchindex > 0 then
	// Set the text.
	ls_foundtext = this.Text (li_searchindex)
	this.text = ls_foundtext
	
	// Determine what to highlight or where to move the cursor.
	if li_searchtextlen = len(ls_foundtext) THEN	
		// Move the cursor to the end.
		this.SelectText (Len (ls_foundtext)+1, 0)	
	else
		// Highlight the portion the user has not actually typed.		
		this.SelectText (li_searchtextlen + 1, Len (ls_foundtext))
	end if
end if

end event

     
Name Owner
No Data

     
Name Owner
dropdownlistbox.finditem dropdownlistbox
dropdownlistbox.selecttext dropdownlistbox
dropdownlistbox.text dropdownlistbox
systemfunctions.keydown systemfunctions
systemfunctions.len systemfunctions

     
Full name
No Data

     
Name Scope
No Data