IDE: make OptionsEditor highlight all matches of the filter string

git-svn-id: trunk@35671 -
This commit is contained in:
juha 2012-03-03 15:55:46 +00:00
parent 328a1c9564
commit c70cb74622
2 changed files with 11 additions and 12 deletions

View File

@ -3,7 +3,7 @@ inherited IDEOptionsDialog: TIDEOptionsDialog
Height = 500
Top = 182
Width = 700
ActiveControl = CatTVSplitter
ActiveControl = FilterEdit
BorderIcons = [biSystemMenu]
Caption = 'IDEOptionsDialog'
ClientHeight = 500

View File

@ -427,19 +427,20 @@ function TAbstractIDEOptionsEditor.ContainsTextInCaption(AText: string): Boolean
const
FoundColor = clFuchsia;
var
UpperText: String;
LowerText: String;
function Search(AControl: TControl): Boolean;
var
i: Integer;
AWinControl: TWinControl;
begin
if Pos(UpperText, Uppercase(AControl.Caption))>0 then begin
//if Length(UpperText)>2 then
// DebugLn('TAbstractIDEOptionsEditor.ContainsTextInCaption: Searching "', UpperText,
Result:=False;
if Pos(LowerText, LowerCase(AControl.Caption))>0 then begin
//if Length(LowerText)>2 then
// DebugLn('TAbstractIDEOptionsEditor.ContainsTextInCaption: Searching "', LowerText,
// '", Found "', AControl.Caption, '", in ', AControl.Name);
AControl.Font.Color:=FoundColor;
exit(True);
Result:=True;
end
else if AControl.Font.Color=FoundColor then
AControl.Font.Color:=clDefault;
@ -447,16 +448,14 @@ var
AWinControl:=TWinControl(AControl);
for i:=0 to AWinControl.ControlCount-1 do
// Memo.Caption return all the lines, skip it.
if not (AWinControl.Controls[i] is TMemo) then begin
Result:=Search(AWinControl.Controls[i]); // Recursive call
if Result then exit;
end;
if not (AWinControl.Controls[i] is TMemo) then
if Search(AWinControl.Controls[i]) then // Recursive call
Result:=True;
end;
Result:=False;
end;
begin
UpperText:=Uppercase(AText);
LowerText:=LowerCase(AText);
Result:=Search(Self);
end;