mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
When double clicking a helper tree, the query editor should only get focus if there is non empty text. First level nodes never create text but double clicking them stole focus.
This commit is contained in:
@ -4748,14 +4748,14 @@ procedure TMainForm.SynMemoQueryDragDrop(Sender, Source: TObject; X,
|
|||||||
var
|
var
|
||||||
src : TControl;
|
src : TControl;
|
||||||
Text, ItemText: String;
|
Text, ItemText: String;
|
||||||
LoadText, ShiftPressed: Boolean;
|
ShiftPressed: Boolean;
|
||||||
Tree: TVirtualStringTree;
|
Tree: TVirtualStringTree;
|
||||||
Node: PVirtualNode;
|
Node: PVirtualNode;
|
||||||
begin
|
begin
|
||||||
// dropping a tree node or listbox item into the query-memo
|
// dropping a tree node or listbox item into the query-memo
|
||||||
ActiveQueryMemo.UndoList.AddGroupBreak;
|
ActiveQueryMemo.UndoList.AddGroupBreak;
|
||||||
src := Source as TControl;
|
src := Source as TControl;
|
||||||
LoadText := True;
|
Text := '';
|
||||||
ShiftPressed := KeyPressed(VK_SHIFT);
|
ShiftPressed := KeyPressed(VK_SHIFT);
|
||||||
Tree := ActiveQueryHelpers;
|
Tree := ActiveQueryHelpers;
|
||||||
// Check for allowed controls as source has already
|
// Check for allowed controls as source has already
|
||||||
@ -4768,12 +4768,9 @@ begin
|
|||||||
end else if src = Tree then begin
|
end else if src = Tree then begin
|
||||||
if (Tree.GetNodeLevel(Tree.FocusedNode) = 1) and Assigned(Tree.FocusedNode) then begin
|
if (Tree.GetNodeLevel(Tree.FocusedNode) = 1) and Assigned(Tree.FocusedNode) then begin
|
||||||
case Tree.FocusedNode.Parent.Index of
|
case Tree.FocusedNode.Parent.Index of
|
||||||
HELPERNODE_SNIPPETS: begin
|
HELPERNODE_SNIPPETS:
|
||||||
QueryLoad( DirnameSnippets + Tree.Text[Tree.FocusedNode, 0] + '.sql', False, nil);
|
Text := ReadTextFile(DirnameSnippets + Tree.Text[Tree.FocusedNode, 0] + '.sql', nil);
|
||||||
LoadText := False;
|
|
||||||
end;
|
|
||||||
else begin
|
else begin
|
||||||
Text := '';
|
|
||||||
Node := Tree.GetFirstChild(Tree.FocusedNode.Parent);
|
Node := Tree.GetFirstChild(Tree.FocusedNode.Parent);
|
||||||
while Assigned(Node) do begin
|
while Assigned(Node) do begin
|
||||||
if Tree.Selected[Node] then begin
|
if Tree.Selected[Node] then begin
|
||||||
@ -4792,15 +4789,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
Text := 'Error: Unspecified source control in drag''n drop operation!';
|
raise Exception.Create('Unspecified source control in drag''n drop operation!');
|
||||||
|
|
||||||
// Only insert text if no previous action did the job.
|
if Text <> '' then begin
|
||||||
// Should be false when dropping a snippet-file here
|
|
||||||
if LoadText then
|
|
||||||
ActiveQueryMemo.SelText := Text;
|
ActiveQueryMemo.SelText := Text;
|
||||||
ActiveQueryMemo.UndoList.AddGroupBreak;
|
ActiveQueryMemo.UndoList.AddGroupBreak;
|
||||||
// Requires to set focus, as doubleclick actions also call this procedure
|
// Requires to set focus, as doubleclick actions also call this procedure
|
||||||
ActiveQueryMemo.SetFocus;
|
ActiveQueryMemo.SetFocus;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user