unit DBLookupComboBoxEx;
interface
uses
Windows, SysUtils, Classes, Controls, Messages, DBCtrls, Types;
type
TDBLookupComboBoxEx =
class(TDBLookupComboBox)
private
protected
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean;
override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean;
override;
public
published
property OnMouseWheelDown;
property OnMouseWheelUp;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('
XPCtrls', [TDBLookupComboBoxEx]);
end;
{ TDBLookupComboBoxEx }
function TDBLookupComboBoxEx.DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean;
begin
Result := False;
if Assigned(OnMouseWheelDown)
then
OnMouseWheelDown(Self, Shift, MousePos, Result);
if (
not Result)
and (ListSource.DataSet.Active)
then
begin
Perform(WM_KEYDOWN, VK_DOWN, 0);
// Tastaturereignis wird der ComboBox untergejubelt
// ListSource.DataSet.MoveBy(1); // Originalzeile aus DBGrid
Result := True;
end;
end;
function TDBLookupComboBoxEx.DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean;
begin
Result := False;
if Assigned(OnMouseWheelUp)
then
OnMouseWheelUp(Self, Shift, MousePos, Result);
if (
not Result)
and (ListSource.DataSet.Active)
then
begin
Perform(WM_KEYDOWN, VK_UP, 0);
// Tastaturereignis wird der ComboBox untergejubelt
// ListSource.DataSet.MoveBy(-1); // Originalzeile aus DBGrid
Result := True;
end;
end;
end.