TWebDBGrid mouse wheel scrolling not working

My DBGrid has these options set:

[goFixedVertLine,goFixedHorzLine,goVertLine,goHorzLine,goDrawFocusSelected,goColSizing,goRowSelect,goFixedRowDefAlign]

When hovering with the mouse pointer over the active DBGrid and moving the mouse wheel up and down, I would expect the dataset cursor to move up and down as well, same as with the VCL DBGrid. Instead, the whole form is scrolled, which is unwanted.

Is it possible to configure the DBGrid such that only the "selected row" moves up and down instead of the whole form?

Many thanks!

At this moment, mouse wheel scrolling does not change the DB cursor. It scrolls the grid (as tested with demo Demo\Basics\DBGrid

Any chance to intercept the mouse wheel event and move the DB cursor myself?

From OnMouseWheelDown / OnMouseWheelUp event?

grafik
These events don't seem to exist. Or are they just not published?

Just came across the TWebElementActionList. These actions seem to be able to trigger on mouse wheel movements (event "heWheel"). Can I somehow connect that with a WebDBGrid?

The obvious question, do you use the latest version as these events ARE there

image

Sorry, thought you meant TWebForm events. And regarding the ones from the DBGrid, I misinterpreted them to relate to clicking with the mouse wheel. My fault, although the event naming is a bit misleading. I checked these events now with the DBGrid demo and they do in fact fire on mouse wheel turning. Thank you for pointing me in the right direction!

Wonderful. This extension to the DBGrid demo exactly does what I was looking for:

procedure TForm1.WebDBGrid1MouseWheelDown(Sender: TObject; Shift: TShiftState;
    MousePos: TPoint; var Handled: Boolean);
begin
 Handled := True;
 Console.log('MW down');
 If not WebClientDataSet1.Eof then
  WebClientDataSet1.Next;
end;

procedure TForm1.WebDBGrid1MouseWheelUp(Sender: TObject; Shift: TShiftState;
    MousePos: TPoint; var Handled: Boolean);
begin
 Handled := True;
 Console.log('MW up');
 If not WebClientDataSet1.Bof then
  WebClientDataSet1.Prior;
end;
2 Likes

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.