When dragging a table into a query editor while Shift is pressed, include its database name. Fixes issue #1749 . Fixes issue #1661.

This commit is contained in:
Ansgar Becker
2010-03-15 23:40:26 +00:00
parent 6c4be937ab
commit 71c687986f
2 changed files with 17 additions and 3 deletions

View File

@ -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.

View File

@ -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 );