|
pfc_editchanged
|
|
Full name
|
pfc_n_cst_dwsrv_dropdownsearch.pfc_editchanged
|
Access
|
public
|
Extend of
|
|
Return value
|
|
Prototype
|
event pfc_editchanged(ref long,ref dwobject,ref string)
|
Name
|
Datatype
|
lb_matchfound
|
boolean
|
li_ddlb_index
|
long
|
li_searchtextlen
|
integer
|
ll_dddw_rowcount
|
long
|
ll_findrow
|
long
|
ls_dddw_displaycol
|
string
|
ls_displaydata_value
|
string
|
ls_findexp
|
string
|
ls_foundtext
|
string
|
ls_searchcolname
|
string
|
ls_searchtext
|
string
|
event pfc_editchanged;//////////////////////////////////////////////////////////////////////////////
//
// Event: pfc_editchanged
//
// Arguments:
// al_row: row number
// adwo_obj: DataWindow object passed by reference
// as_data: The current data on the column. (The search text)
//
// Returns: none
//
// Description: This event should be mapped to the editchanged
// event of a DataWindow. When is event is "fired", it will use
// instance variables (set in the pfc_itemfocuschanged) to access
// items in the instance attribute class.
// The instance attribute class contains information about the dddw and
// ddlb columns this service uses.
//
//////////////////////////////////////////////////////////////////////////////
//
// Revision History
//
// Version
// 5.0 Initial version
//
//////////////////////////////////////////////////////////////////////////////
//
// 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_searchtextlen
long ll_findrow
string ls_dddw_displaycol
string ls_foundtext
string ls_findexp
string ls_searchcolname
long ll_dddw_rowcount
long li_ddlb_index=0
string ls_displaydata_value
string ls_searchtext
boolean lb_matchfound=False
// Check requirements.
If IsNull(adwo_obj) or Not IsValid(adwo_obj) Then Return
// Confirm that the search capabilities are valid for this column.
if ib_performsearch=False or ii_currentindex <= 0 THEN return
// Get information on the column and text.
ls_searchcolname = adwo_obj.Name
ls_searchtext = as_data
li_searchtextlen = Len (ls_searchtext)
// If the user performed a delete operation, do not perform the search.
// If the text entered is the same as the last search, do not perform another search.
If (li_searchtextlen < Len(is_textprev)) or &
(Lower (ls_searchtext) = Lower (is_textprev)) Then
// Store the previous text information.
is_textprev = ''
Return
End If
// Store the previous text information.
is_textprev = ls_searchtext
If inv_columns[ii_currentindex].s_editstyle = 'dddw' Then
// *** DropDownDatawindow Search ***
// Build the find expression to search the dddw for the text
// entered in the parent datawindow column.
ls_dddw_displaycol = adwo_obj.Describe("dddw.displaycolumn")
ls_findexp = "Lower (Left (" + ls_dddw_displaycol + ", " + &
String (li_searchtextlen) + ")) = '" + Lower (ls_searchtext) + "'"
// Perform the Search on the dddw.
ll_dddw_rowcount = inv_columns[ii_currentindex].dwc_object.rowcount()
ll_findrow = inv_columns[ii_currentindex].dwc_object.Find (ls_findexp, 0, ll_dddw_rowcount)
// Determine if a match was found on the dddw.
lb_matchfound = (ll_findrow > 0)
// Set the found text if found on the dddw.
if lb_matchfound then
// Get the text found.
ls_foundtext = inv_columns[ii_currentindex].dwc_object.GetItemString (&
ll_findrow, ls_dddw_displaycol)
End If
ElseIf inv_columns[ii_currentindex].s_editstyle = 'ddlb' Then
// *** DropDownListBox Search ***
// Loop around the entire Code Table until a match is found (if any).
Do
li_ddlb_index ++
ls_displaydata_value = idw_requestor.GetValue(ls_searchcolname, li_ddlb_index)
If ls_displaydata_value = '' Then
// No more entries on the Code Table.
Exit
End If
// Determine if a match has been found on the ddlb.
lb_matchfound = ( Lower(ls_searchtext) = Lower( Left(ls_displaydata_value, Len(ls_searchtext))) )
Loop Until lb_matchfound
// Check if a match was found on the ddlb.
If lb_matchfound Then
// Get the text found by discarding the data value (just keep the display value).
ls_foundtext = Left (ls_displaydata_value, Pos(ls_displaydata_value,'~t') -1)
End If
End If
// For either dddw or ddlb, check if a match was found.
If lb_matchfound Then
// Set the text.
idw_requestor.SetText (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
idw_requestor.SelectText (Len (ls_foundtext)+1, 0)
else
// Hightlight the portion the user has not actually typed.
idw_requestor.SelectText (li_searchtextlen + 1, Len (ls_foundtext))
end if
end if
end event
Name
|
Owner
|
datawindow.getvalue |
datawindow
|
datawindow.selecttext |
datawindow
|
datawindow.settext |
datawindow
|
datawindowchild.find |
datawindowchild
|
datawindowchild.getitemstring |
datawindowchild
|
datawindowchild.rowcount |
datawindowchild
|
systemfunctions.isnull |
systemfunctions
|
systemfunctions.isvalid |
systemfunctions
|
systemfunctions.left |
systemfunctions
|
systemfunctions.len |
systemfunctions
|
systemfunctions.lower |
systemfunctions
|
systemfunctions.pos |
systemfunctions
|
systemfunctions.string |
systemfunctions
|