diff --git a/source/helpers.pas b/source/helpers.pas index 2b8e839e..4621ceb9 100644 --- a/source/helpers.pas +++ b/source/helpers.pas @@ -247,6 +247,7 @@ type function CheckForSecondInstance: Boolean; function GetParentFormOrFrame(Comp: TWinControl): TWinControl; function GetIndexIcon(IndexType: String): Integer; + function KeyPressed(Code: Integer): Boolean; var MainReg: TRegistry; @@ -3404,6 +3405,16 @@ begin end; +function KeyPressed(Code: Integer): Boolean; +var + State: TKeyboardState; +begin + // Checks whether a key is pressed, defined by virtual key code + GetKeyboardState(State); + Result := (State[Code] and 128) <> 0; +end; + + end. diff --git a/source/main.pas b/source/main.pas index c3d03b85..c6f7d7b9 100644 --- a/source/main.pas +++ b/source/main.pas @@ -4725,9 +4725,12 @@ begin LoadText := True; // Check for allowed controls as source has already // been performed in OnDragOver. So, only do typecasting here. - if src = DBtree then - Text := mask(DBtree.Text[DBtree.FocusedNode, 0]) - else if (src = ActiveQueryHelpers) and (ActiveQueryHelpers.ItemIndex > -1) then begin + if src = DBtree then begin + // Insert table or database name. If a table is dropped and Shift is pressed, prepend the db name. + Text := mask(DBtree.Text[DBtree.FocusedNode, 0]); + if (DBtree.GetNodeLevel(DBtree.FocusedNode)=2) and KeyPressed(VK_SHIFT) then + Text := mask(DBtree.Text[DBtree.FocusedNode.Parent, 0]) + '.' + Text; + end else if (src = ActiveQueryHelpers) and (ActiveQueryHelpers.ItemIndex > -1) then begin // Snippets tab if tabsetQueryHelpers.TabIndex = 3 then begin QueryLoad( DirnameSnippets + ActiveQueryHelpers.Items[ActiveQueryHelpers.ItemIndex] + '.sql', False );