Thanks Johan Fauss for your swift reply. Here are the details.
One Window - [w_bkcolor]
One DataWindow - [dw_bkcolor]
One DropDownDataWindow - [ddw_city]
Datawindow contains three fields, two edit fields and one field with dddw
dw_1 control in the window got codes in 2 events.
Itemfocuschanged &
EditChanged
// ********************************************************
Code in ItemFocusChanged // Got from STD-FC framework
String ls_object // Object Var.
String ls_type // Work Var.
String ls_select // Work Var.
If ib_focus_colour = TRUE THEN // Focus Colour ON?
If LEN (is_column_focus) = 0 THEN // YES, Previous Focus?
ls_object = THIS.GetColumnName ( ) // Get 1st Focus Column
If Len (ls_object) > 0 THEN // Valid Coloumn?
is_column_focus = 'STD-FC-DUMMY' // NO=> Save "Dummy"
ls_type = THIS.Describe (ls_object + ".Edit.Required") // Get Status
If Lower (ls_type) = "yes" THEN // Required?
is_save_colour = THIS.Describe (ls_object + &
".Background.Color") // YES=>Save it's colour!
End If
ls_type = THIS.Describe (ls_object + ".EditMask.Required") // Get 2nd Type
If Lower (ls_type) = "yes" THEN // Mask Requierd?
is_save_colour = THIS.Describe (ls_object + &
".Background.Color") // YES=>Save it's colour!
End If
ls_type = THIS.Describe (ls_object + ".DDDW.Required") // Get 3rd Type
If Lower (ls_type) = "yes" THEN // Mask Requierd?
is_save_colour = THIS.Describe (ls_object + &
".Background.Color") // YES=>Save it's colour!
End If
ls_type = THIS.Describe (ls_object + ".DDLB.Required") // Get 4th Type
If Lower (ls_type) = "yes" THEN // Mask Requierd?
is_save_colour = THIS.Describe (ls_object + &
".Background.Color") // YES=>Save it's colour!
End If
End If
This.Post Event itemfocuschanged (row, dwo)
Return
End If
If is_column_focus <> DWO.Name THEN // Same Column?
ls_type = THIS.Describe ( DWO.Name + ".Type") // NO=>Get Obj. type
If ls_type = 'column' THEN // Column?
THIS.Modify (is_column_focus + ".Background.Color='" + &
is_save_colour + "'") // YES=>Restore Colour
is_column_focus = DWO.Name // Save curr. col.
is_save_colour = THIS.Describe (is_column_focus + &
".Background.Color") // Save curr. Colour
// This.Modify (is_column_focus + ".Background.Color='" + &
// String(f_get_focus_color ()) + "'") // Set Focus colour!
ls_select = THIS.Describe (is_column_focus + ".Edit.AutoSelect") // Get AutoSelect property
If Lower (ls_select) = "yes" THEN // Was it ON?
THIS.selecttext (1, 99999) // YES=>Select it again!
End If
End If
End If
End If
// ***************************************
// Code in editchanged
//*********************************************
If dwo.name = 'city' Then
datawindowchild dw
If dwo.name = 'city' Then
dw = dwc1
End If
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
ls_searchcolname = dwo.Name
ls_searchtext = data
li_searchtextlen = Len (ls_searchtext)
If (li_searchtextlen < Len(is_textprev)) or (Lower (ls_searchtext) = Lower (is_textprev)) Then
is_textprev = ''
Return
End If
is_textprev = ls_searchtext
ls_dddw_displaycol = dwo.dddw.displaycolumn
ls_findexp = "Lower (Left (" + ls_dddw_displaycol + ", " + String (li_searchtextlen) + ")) = '" + Lower (ls_searchtext) + "'"
ll_dddw_rowcount = dw.rowcount()
ll_findrow = dw.Find (ls_findexp, 0, ll_dddw_rowcount)
ib_matchfound = (ll_findrow > 0)
if ib_matchfound then
ls_foundtext = dw.GetItemString (ll_findrow, ls_dddw_displaycol)
Else
is_textprev = ''
This.SetText('')
End If
If ib_matchfound Then
This.SetText (ls_foundtext)
if li_searchtextlen = len(ls_foundtext) THEN
This.SelectText (Len (ls_foundtext)+1, 0)
else
This.SelectText (li_searchtextlen + 1, Len (ls_foundtext))
end if
End If
End If
// ********************************************************
With the above codes,
When I type in City column, edit changed codes doesn't search values [ typeahead ]
When I comment out 2 lines in ItemFocusChanged [ Line No. 51 & 52 ]
// This.Modify (is_column_focus + ".Background.Color='" + &
// String(f_get_focus_color ()) + "'") // Set Focus colour!
Everything works fine.
I've attached a sample application [with the above code only] demonstrating this issue as a rar file. [using PB 2017 R3].
Happiness Always
BKR Sivaprakash