Hallo,
Zitat von
Beg:
kann man in einer TDBLookupListBox mit dem Mausrad scrollen?
aber sicher kann man das:
Delphi-Quellcode:
type
TDemoForm = class(TForm)
DBLookupListBox: TDBLookupListBox;
procedure FormCreate(Sender: TObject);
private
procedure DBLookupListBoxMouseWheelDown(Sender: TObject;
Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
procedure DBLookupListBoxMouseWheelUp(Sender: TObject;
Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
end;
implementation
type
THackedDBLookupListBox = class(TDBLookupListBox);
procedure TDemoForm.FormCreate(Sender: TObject);
begin
with THackedDBLookupListBox(DBLookupListBox) do
begin
OnMouseWheelDown := DBLookupListBoxMouseWheelDown;
OnMouseWheelUp := DBLookupListBoxMouseWheelUp;
end;
end;
procedure TDemoForm.DBLookupListBoxMouseWheelDown(Sender: TObject;
Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
with Sender as TDBLookupListBox do
begin
DataSource.Edit;
ListSource.DataSet.MoveBy(1);
DataSource.DataSet.FieldValues[DataField] := ListSource.DataSet.FieldValues[KeyField];
end;
Handled := true;
end;
procedure TDemoForm.DBLookupListBoxMouseWheelUp(Sender: TObject;
Shift: TShiftState; MousePos: TPoint; var Handled: Boolean);
begin
with Sender as TDBLookupListBox do
begin
DataSource.Edit;
ListSource.DataSet.MoveBy(-1);
DataSource.DataSet.FieldValues[DataField] := ListSource.DataSet.FieldValues[KeyField];
end;
Handled := true;
end;
Grüße vom marabu