TwwLayoutgrid using mouse wheel without record change

Comments

1 comment

  • Roy Woll

    Unfortunately, this is not currently supported. We will integrate this in the future. You could workaround this issue if PaintOptions.PaintEfficiency is set to LoadAllRecords by using the following code in OnMouseWheel. OnMouseWheel is not published so you would need to create the method and then assign it in your form's onShow event. Also please note that this code will not work if PaintEfficiency is set to buffer records.

       wwLayoutGrid1.onmouseWheel:= wwLayoutGrid1MouseWheel;
    
    type TOpenLayoutGrid = class(TwwLayoutGrid);
    procedure TLayoutGridVertForm.wwLayoutGrid1MouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; var Handled: Boolean); var offset: single; tempRecNo: integer; begin Offset:= TwwLayoutGrid(sender).MouseWheelOffset; Offset := Offset * -1 * (WheelDelta / 120); if (offset>0) and (offset<=0.50) then offset:= 0.51; // 9/2/15 - scroll at least once if (offset<0) and (offset>=-0.50) then offset:= -0.51; with TwwLayoutGrid(Sender) do begin tempRecNo:= DataRecNo+round(offset); if tempRecNo<0 then tempRecNo:= 0 else if tempRecNo>=CachedRecordCount then tempRecNo:= CachedRecordCount-1; TOpenLayoutGrid(Sender).ScrollBy(round(offset)); // 8/2/2021 - Dont move current record position Invalidate; Handled:= true; end; end;
    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk