mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Handle mouse wheel scrolling in any VirtualTree under mouse, without having focus. Fixes issue #447.
This commit is contained in:
@@ -15,6 +15,7 @@ object MainForm: TMainForm
|
||||
OnClose = FormClose
|
||||
OnCloseQuery = FormCloseQuery
|
||||
OnCreate = FormCreate
|
||||
OnMouseWheel = FormMouseWheel
|
||||
OnResize = FormResize
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
|
||||
@@ -703,6 +703,8 @@ type
|
||||
procedure menuQueryHelpersGenerateStatementClick(Sender: TObject);
|
||||
procedure actDataDuplicateRowExecute(Sender: TObject);
|
||||
procedure actSelectInverseExecute(Sender: TObject);
|
||||
procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
|
||||
var Handled: Boolean);
|
||||
private
|
||||
ReachedEOT : Boolean;
|
||||
FDelimiter: String;
|
||||
@@ -8837,5 +8839,26 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TMainForm.FormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
|
||||
var Handled: Boolean);
|
||||
var
|
||||
Control: TWinControl;
|
||||
VT: TBaseVirtualTree;
|
||||
begin
|
||||
// Wheel scrolling only works in component which has focus. Help out by doing that by hand at least for any VirtualTree.
|
||||
// See http://www.delphipraxis.net/viewtopic.php?p=1113607
|
||||
// TODO: Does not work when a SynMemo has focus, probably related to the broken solution of this issue:
|
||||
// http://sourceforge.net/tracker/index.php?func=detail&aid=1574059&group_id=3221&atid=103221
|
||||
Control := FindVCLWindow(MousePos);
|
||||
if (Control is TBaseVirtualTree) and (not Control.Focused) and PtInRect(Control.ClientRect, Control.ScreenToClient(MousePos)) then begin
|
||||
VT := Control as TBaseVirtualTree;
|
||||
VT.OffsetY := VT.OffsetY + (WheelDelta div 2); // Don't know why, but WheelDelta is twice as big as it normally appears
|
||||
VT.UpdateScrollBars(True);
|
||||
Handled := True;
|
||||
end else
|
||||
Handled := False;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user