TwwLayoutgrid using mouse wheel without record change
How do I need to set the properties so that I can use the mouse wheel but it doesn't change the record in the layoutgrid. So actually it does then the same as touch scrolling.
-
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;
Please sign in to leave a comment.
Comments
1 comment