I am trying to implement a Red Bordercolor for invalid entries on the TAdvSearchComboBox.
I tried adding events to OnChange, OnExit, OnSelect and OnKeypress that execute the following code:
With AdvSearchComboBox1 do
begin
var valid : boolean;
valid := (Items.IndexOf(Text) <> -1);
var NewColor : TColor;
if valid then
NewColor := clGreen
else
NewColor := clRed;
if BorderColor <> NewColor then
begin
BorderColor := NewColor;
Color := NewColor;
Repaint;
result := true;
end;
end;
Still it does not work fully reliable, when i first enter a partial text, select it from the dropdown, the red color remains.
How to best implement this?
Thanks in advance