Skip to content

Commit

Permalink
Adapt TVargrid to Lazarus 1.8
Browse files Browse the repository at this point in the history
Apparently original author make a fix for better scroll in TVarGrid. That fix works great until Lazarus 1.6 but in 1.8 the number of lines scrolled are incorrect.
This fix make that workaround conditional to Lazarus 1.6 or lower.
  • Loading branch information
antekgla committed Mar 30, 2018
1 parent fbfc75f commit ab033d9
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion vargrid.pas
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
interface

uses
Classes, SysUtils, Grids, VarList, Graphics, Controls, LMessages, Forms, StdCtrls, LCLType, ExtCtrls,LazUTF8;
Classes, SysUtils, Grids, VarList, Graphics, Controls, LMessages, Forms, StdCtrls, LCLType, ExtCtrls,LazUTF8, LCLVersion;

type
TVarGrid = class;
Expand Down Expand Up @@ -127,9 +127,11 @@ TVarGrid = class(TCustomDrawGrid)
procedure SetupCell(ACol, ARow: integer; AState: TGridDrawState; out CellAttribs: TCellAttributes);
procedure DoOnCheckBoxClick(ACol, ARow: integer);
procedure DoOnTreeButtonClick(ACol, ARow: integer);
{$IF LCL_FULLVERSION < 1080000}
function DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheelUp(Shift: TShiftState; MousePos: TPoint): Boolean; override;
function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override;
{$ENDIF}
procedure DrawRow(aRow: Integer); override;
function GetCells(ACol, ARow: Integer): string; override;
function GetEditText(ACol, ARow: Longint): string; override;
Expand Down Expand Up @@ -1123,6 +1125,8 @@ procedure TVarGrid.DoOnTreeButtonClick(ACol, ARow: integer);
FOnTreeButtonClick(Self, ACol - FixedCols, ARow - FixedRows, ColToDataCol(ACol));
end;

{$IF LCL_FULLVERSION < 1080000}

function TVarGrid.DoMouseWheelDown(Shift: TShiftState; MousePos: TPoint): Boolean;
begin
Result := False;
Expand All @@ -1149,6 +1153,8 @@ function TVarGrid.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos
end;
end;

{$ENDIF}

constructor TVarGrid.Create(AOwner: TComponent);
begin
FRow:=-1;
Expand Down

1 comment on commit ab033d9

@antekgla
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fix #1062

Please sign in to comment.