mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 15:19:29 +02:00
IDE: search results dialog: fix focus behavior - focus (new) result treeview unless the filter edit was explicitely focused.
git-svn-id: trunk@57893 -
This commit is contained in:
parent
3687c71bc4
commit
3efecb9efa
@ -8839,11 +8839,7 @@ begin
|
|||||||
end else if State=iwgfDisabled then
|
end else if State=iwgfDisabled then
|
||||||
SearchResultsView.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowSearchResultsView'){$ENDIF};
|
SearchResultsView.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('TMainIDE.DoShowSearchResultsView'){$ENDIF};
|
||||||
if State>=iwgfShow then
|
if State>=iwgfShow then
|
||||||
begin
|
|
||||||
IDEWindowCreators.ShowForm(SearchresultsView,State=iwgfShowOnTop);
|
IDEWindowCreators.ShowForm(SearchresultsView,State=iwgfShowOnTop);
|
||||||
if (State=iwgfShowOnTop) and SearchresultsView.SearchInListEdit.CanFocus then
|
|
||||||
SearchresultsView.SearchInListEdit.SetFocus;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMainIDE.GetTestBuildDirectory: string;
|
function TMainIDE.GetTestBuildDirectory: string;
|
||||||
|
@ -23,6 +23,7 @@ object SearchResultsView: TSearchResultsView
|
|||||||
MultiLine = True
|
MultiLine = True
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
OnChange = ResultsNoteBookPageChanged
|
OnChange = ResultsNoteBookPageChanged
|
||||||
|
OnChanging = ResultsNoteBookChanging
|
||||||
OnCloseTabClicked = ResultsNoteBookClosetabclicked
|
OnCloseTabClicked = ResultsNoteBookClosetabclicked
|
||||||
OnMouseDown = ResultsNoteBookMouseDown
|
OnMouseDown = ResultsNoteBookMouseDown
|
||||||
Options = [nboShowCloseButtons, nboMultiLine]
|
Options = [nboShowCloseButtons, nboMultiLine]
|
||||||
@ -68,9 +69,9 @@ object SearchResultsView: TSearchResultsView
|
|||||||
Top = 0
|
Top = 0
|
||||||
Width = 738
|
Width = 738
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
NumGlyphs = 1
|
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
|
NumGlyphs = 1
|
||||||
MaxLength = 0
|
MaxLength = 0
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnChange = SearchInListChange
|
OnChange = SearchInListChange
|
||||||
|
@ -162,6 +162,7 @@ type
|
|||||||
procedure mniCopySelectedClick(Sender: TObject);
|
procedure mniCopySelectedClick(Sender: TObject);
|
||||||
procedure mniExpandAllClick(Sender: TObject);
|
procedure mniExpandAllClick(Sender: TObject);
|
||||||
procedure mniCollapseAllClick(Sender: TObject);
|
procedure mniCollapseAllClick(Sender: TObject);
|
||||||
|
procedure ResultsNoteBookChanging(Sender: TObject; var AllowChange: Boolean);
|
||||||
procedure ResultsNoteBookMouseDown(Sender: TObject; Button: TMouseButton;
|
procedure ResultsNoteBookMouseDown(Sender: TObject; Button: TMouseButton;
|
||||||
{%H-}Shift: TShiftState; X, Y: Integer);
|
{%H-}Shift: TShiftState; X, Y: Integer);
|
||||||
procedure TreeViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure TreeViewKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
@ -182,6 +183,8 @@ type
|
|||||||
Shift: TShiftState; X, Y: Integer);
|
Shift: TShiftState; X, Y: Integer);
|
||||||
private
|
private
|
||||||
FMaxItems: integer;
|
FMaxItems: integer;
|
||||||
|
FFocusTreeViewInOnChange: Boolean;
|
||||||
|
FFocusTreeViewInEndUpdate: Boolean;
|
||||||
FWorkedSearchText: string;
|
FWorkedSearchText: string;
|
||||||
FOnSelectionChanged: TNotifyEvent;
|
FOnSelectionChanged: TNotifyEvent;
|
||||||
FMouseOverIndex: integer;
|
FMouseOverIndex: integer;
|
||||||
@ -192,6 +195,8 @@ type
|
|||||||
function GetItems(Index: integer): TStrings;
|
function GetItems(Index: integer): TStrings;
|
||||||
procedure SetMaxItems(const AValue: integer);
|
procedure SetMaxItems(const AValue: integer);
|
||||||
procedure UpdateToolbar;
|
procedure UpdateToolbar;
|
||||||
|
protected
|
||||||
|
procedure Loaded; override;
|
||||||
public
|
public
|
||||||
function AddSearch(const ResultsName: string;
|
function AddSearch(const ResultsName: string;
|
||||||
const SearchText: string;
|
const SearchText: string;
|
||||||
@ -485,7 +490,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchResultsView.ResultsNoteBookPageChanged (Sender: TObject );
|
procedure TSearchResultsView.ResultsNoteBookPageChanged(Sender: TObject);
|
||||||
var
|
var
|
||||||
CurrentTV: TLazSearchResultTV;
|
CurrentTV: TLazSearchResultTV;
|
||||||
begin
|
begin
|
||||||
@ -493,6 +498,8 @@ begin
|
|||||||
if Assigned(CurrentTV) and not (csDestroying in CurrentTV.ComponentState) then begin
|
if Assigned(CurrentTV) and not (csDestroying in CurrentTV.ComponentState) then begin
|
||||||
SearchInListEdit.FilteredTreeview := CurrentTV;
|
SearchInListEdit.FilteredTreeview := CurrentTV;
|
||||||
SearchInListEdit.Filter := CurrentTV.SearchInListPhrases;
|
SearchInListEdit.Filter := CurrentTV.SearchInListPhrases;
|
||||||
|
if FFocusTreeViewInOnChange then
|
||||||
|
ActiveControl := CurrentTV;
|
||||||
end;
|
end;
|
||||||
UpdateToolbar;
|
UpdateToolbar;
|
||||||
end;
|
end;
|
||||||
@ -621,6 +628,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
UpdateToolbar;
|
UpdateToolbar;
|
||||||
|
if FFocusTreeViewInEndUpdate and Assigned(CurrentTV) then
|
||||||
|
ActiveControl := CurrentTV
|
||||||
|
else
|
||||||
|
if SearchInListEdit.CanFocus then
|
||||||
|
ActiveControl := SearchInListEdit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TSearchResultsView.Parse_Search_Phrases(var slPhrases: TStrings);
|
procedure TSearchResultsView.Parse_Search_Phrases(var slPhrases: TStrings);
|
||||||
@ -648,6 +660,15 @@ begin
|
|||||||
end;//End for-loop i
|
end;//End for-loop i
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TSearchResultsView.ResultsNoteBookChanging(Sender: TObject;
|
||||||
|
var AllowChange: Boolean);
|
||||||
|
var
|
||||||
|
CurrentTV: TLazSearchResultTV;
|
||||||
|
begin
|
||||||
|
CurrentTV := GetTreeView(ResultsNoteBook.PageIndex);
|
||||||
|
FFocusTreeViewInOnChange := Assigned(CurrentTV) and CurrentTV.Focused;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSearchResultsView.ClosePage(PageIndex: integer);
|
procedure TSearchResultsView.ClosePage(PageIndex: integer);
|
||||||
var
|
var
|
||||||
CurrentTV: TLazSearchResultTV;
|
CurrentTV: TLazSearchResultTV;
|
||||||
@ -764,6 +785,8 @@ var
|
|||||||
begin
|
begin
|
||||||
Result:= nil;
|
Result:= nil;
|
||||||
if Assigned(ResultsNoteBook) then
|
if Assigned(ResultsNoteBook) then
|
||||||
|
begin
|
||||||
|
FFocusTreeViewInEndUpdate := not (Assigned(ActiveControl) and SearchInListEdit.IsParentOf(ActiveControl));
|
||||||
with ResultsNoteBook do
|
with ResultsNoteBook do
|
||||||
begin
|
begin
|
||||||
FWorkedSearchText:=BeautifyPageName(ResultsName);
|
FWorkedSearchText:=BeautifyPageName(ResultsName);
|
||||||
@ -808,6 +831,7 @@ begin
|
|||||||
SearchInListEdit.Filter:='';
|
SearchInListEdit.Filter:='';
|
||||||
SearchInListEdit.FilteredTreeview := NewTreeView;
|
SearchInListEdit.FilteredTreeview := NewTreeView;
|
||||||
end;//with
|
end;//with
|
||||||
|
end;
|
||||||
end;//AddResult
|
end;//AddResult
|
||||||
|
|
||||||
procedure TSearchResultsView.LazTVShowHint(Sender: TObject; HintInfo: PHintInfo);
|
procedure TSearchResultsView.LazTVShowHint(Sender: TObject; HintInfo: PHintInfo);
|
||||||
@ -838,6 +862,13 @@ begin
|
|||||||
end;//if
|
end;//if
|
||||||
end;//LazTVShowHint
|
end;//LazTVShowHint
|
||||||
|
|
||||||
|
procedure TSearchResultsView.Loaded;
|
||||||
|
begin
|
||||||
|
inherited Loaded;
|
||||||
|
|
||||||
|
ActiveControl := ResultsNoteBook;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TSearchResultsView.TreeViewAdvancedCustomDrawItem(
|
procedure TSearchResultsView.TreeViewAdvancedCustomDrawItem(
|
||||||
Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState;
|
Sender: TCustomTreeView; Node: TTreeNode; State: TCustomDrawState;
|
||||||
Stage: TCustomDrawStage; var PaintImages, DefaultDraw: Boolean);
|
Stage: TCustomDrawStage; var PaintImages, DefaultDraw: Boolean);
|
||||||
|
Loading…
Reference in New Issue
Block a user