mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Add filter input above SQL help tree. Fixes issue #1718. New code mostly from SuperNiFF.
This commit is contained in:
@ -32,31 +32,38 @@ object frmSQLhelp: TfrmSQLhelp
|
|||||||
Align = alLeft
|
Align = alLeft
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object lblTopics: TLabel
|
object treeTopics: TTreeView
|
||||||
AlignWithMargins = True
|
AlignWithMargins = True
|
||||||
Left = 3
|
Left = 3
|
||||||
Top = 8
|
Top = 27
|
||||||
Width = 147
|
Width = 147
|
||||||
Height = 13
|
Height = 309
|
||||||
Align = alBottom
|
Margins.Bottom = 0
|
||||||
Caption = 'Topics:'
|
Align = alClient
|
||||||
end
|
|
||||||
object treeTopics: TTreeView
|
|
||||||
Left = 0
|
|
||||||
Top = 24
|
|
||||||
Width = 153
|
|
||||||
Height = 312
|
|
||||||
Align = alBottom
|
|
||||||
Anchors = [akLeft, akTop, akRight, akBottom]
|
|
||||||
ChangeDelay = 50
|
ChangeDelay = 50
|
||||||
Images = MainForm.ImageListMain
|
Images = MainForm.ImageListMain
|
||||||
Indent = 19
|
Indent = 19
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
ShowLines = False
|
ShowLines = False
|
||||||
TabOrder = 0
|
TabOrder = 1
|
||||||
OnChange = treeTopicsChange
|
OnChange = treeTopicsChange
|
||||||
OnExpanding = treeTopicsExpanding
|
OnExpanding = treeTopicsExpanding
|
||||||
end
|
end
|
||||||
|
object editFilter: TButtonedEdit
|
||||||
|
AlignWithMargins = True
|
||||||
|
Left = 3
|
||||||
|
Top = 3
|
||||||
|
Width = 147
|
||||||
|
Height = 21
|
||||||
|
Margins.Bottom = 0
|
||||||
|
Align = alTop
|
||||||
|
Images = MainForm.ImageListMain
|
||||||
|
LeftButton.Hint = 'Search'
|
||||||
|
LeftButton.ImageIndex = 53
|
||||||
|
LeftButton.Visible = True
|
||||||
|
TabOrder = 0
|
||||||
|
OnChange = editFilterChange
|
||||||
|
end
|
||||||
end
|
end
|
||||||
object StatusBar1: TStatusBar
|
object StatusBar1: TStatusBar
|
||||||
Left = 0
|
Left = 0
|
||||||
|
@ -15,7 +15,6 @@ type
|
|||||||
Splitter1: TSplitter;
|
Splitter1: TSplitter;
|
||||||
treeTopics: TTreeView;
|
treeTopics: TTreeView;
|
||||||
pnlRight: TPanel;
|
pnlRight: TPanel;
|
||||||
lblTopics: TLabel;
|
|
||||||
pnlRightTop: TPanel;
|
pnlRightTop: TPanel;
|
||||||
lblKeyword: TLabel;
|
lblKeyword: TLabel;
|
||||||
lblDescription: TLabel;
|
lblDescription: TLabel;
|
||||||
@ -29,6 +28,7 @@ type
|
|||||||
URIOpenerDescription: TSynURIOpener;
|
URIOpenerDescription: TSynURIOpener;
|
||||||
URIHighlighter: TSynURISyn;
|
URIHighlighter: TSynURISyn;
|
||||||
URIOpenerExample: TSynURIOpener;
|
URIOpenerExample: TSynURIOpener;
|
||||||
|
editFilter: TButtonedEdit;
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure treeTopicsExpanding(Sender: TObject; Node: TTreeNode;
|
procedure treeTopicsExpanding(Sender: TObject; Node: TTreeNode;
|
||||||
var AllowExpansion: Boolean);
|
var AllowExpansion: Boolean);
|
||||||
@ -41,6 +41,7 @@ type
|
|||||||
function ShowHelpItem: Boolean;
|
function ShowHelpItem: Boolean;
|
||||||
procedure fillTreeLevel( ParentNode: TTreeNode );
|
procedure fillTreeLevel( ParentNode: TTreeNode );
|
||||||
procedure findKeywordInTree;
|
procedure findKeywordInTree;
|
||||||
|
procedure editFilterChange(Sender: TObject);
|
||||||
|
|
||||||
private
|
private
|
||||||
{ Private declarations }
|
{ Private declarations }
|
||||||
@ -328,4 +329,44 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmSQLhelp.editFilterChange(Sender: TObject);
|
||||||
|
var
|
||||||
|
tnode: TTreeNode;
|
||||||
|
Results: TMySQLQuery;
|
||||||
|
topic: String;
|
||||||
|
begin
|
||||||
|
// Apply filter text
|
||||||
|
if Trim(editFilter.Text) = '' then begin
|
||||||
|
fillTreeLevel(nil);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Keyword := editFilter.Text;
|
||||||
|
treeTopics.Items.Clear;
|
||||||
|
topic := Keyword;
|
||||||
|
try
|
||||||
|
Screen.Cursor := crHourglass;
|
||||||
|
Results := Mainform.Connection.GetResults('HELP "%'+topic+'%"');
|
||||||
|
while not Results.Eof do begin
|
||||||
|
tnode := treeTopics.Items.AddChild(nil, Results.Col('name'));
|
||||||
|
if Results.ColExists('is_it_category') and (Results.Col('is_it_category') = 'Y') then begin
|
||||||
|
tnode.ImageIndex := ICONINDEX_CATEGORY_CLOSED;
|
||||||
|
tnode.SelectedIndex := ICONINDEX_CATEGORY_OPENED;
|
||||||
|
// Add a dummy item to show the plus-button so the user sees that there this
|
||||||
|
// is a category. When the plus-button is clicked, fetch the content of the category
|
||||||
|
treeTopics.Items.AddChild(tnode, DUMMY_NODE_TEXT);
|
||||||
|
end else begin
|
||||||
|
tnode.ImageIndex := ICONINDEX_HELPITEM;
|
||||||
|
tnode.SelectedIndex := tnode.ImageIndex;
|
||||||
|
end;
|
||||||
|
Results.Next;
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
FreeAndNil(Results);
|
||||||
|
Screen.Cursor := crDefault;
|
||||||
|
end;
|
||||||
|
editFilter.SetFocus;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Reference in New Issue
Block a user