Registriert seit: 30. Okt 2006
Ort: Neuenkirchen
197 Beiträge
Delphi 11 Alexandria
|
Re: Mausrad für nicht fokussierte Komponente
27. Dez 2009, 08:20
Mit VT.OffsetY klappts:
Delphi-Quellcode:
procedure TMainForm.FormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
var Handled: Boolean);
var
Control: TWinControl;
VT: TBaseVirtualTree;
begin
// TODO: Does not work when a SynMemo has focus, probably related to the broken solution of this issue:
// [url]http://sourceforge.net/tracker/index.php?func=detail&aid=1574059&group_id=3221&atid=103221[/url]
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;
|