Skip to content
Permalink
Browse files

Close query tab on click with middle-mouse-button. Closes #779

  • Loading branch information
ansgarbecker committed Dec 15, 2019
1 parent d5968e1 commit eb25bc524e88553b4dc8268c78dfbc8cbb6c7395
Showing with 21 additions and 11 deletions.
  1. +21 −11 source/main.pas
@@ -11183,18 +11183,28 @@ procedure TMainForm.PageControlMainMouseUp(Sender: TObject;
CurTickcount: Cardinal;
TabNumber: Integer;
begin
// Simulate doubleclick on tab to close it
if Button <> mbLeft then
Exit;
CurTickcount := GetTickCount;
TabNumber := GetMainTabAt(X, Y);
if (TabNumber = FLastTabNumberOnMouseUp)
and (CurTickcount - FLastMouseUpOnPageControl <= GetDoubleClickTime) then
CloseQueryTab(TabNumber)
else begin
FLastMouseUpOnPageControl := CurTickcount;
FLastTabNumberOnMouseUp := TabNumber;
// Handle click event on poor PageControl tabs in lack of an OnClick
case Button of
mbLeft: begin
// Simulate doubleclick on tab to close it
CurTickcount := GetTickCount;
TabNumber := GetMainTabAt(X, Y);
if (TabNumber = FLastTabNumberOnMouseUp)
and (CurTickcount - FLastMouseUpOnPageControl <= GetDoubleClickTime) then begin
CloseQueryTab(TabNumber);
end else begin
FLastMouseUpOnPageControl := CurTickcount;
FLastTabNumberOnMouseUp := TabNumber;
end;
end;

mbMiddle: begin
// Middle click on tab
TabNumber := GetMainTabAt(X, Y);
CloseQueryTab(TabNumber);
end;
end;

end;


0 comments on commit eb25bc5

Please sign in to comment.
You can’t perform that action at this time.