procedure TControlScrollBar.InternalSetRange(const AValue: Integer); allows setting negative values.
Original Reporter info from Mantis: lagprogramming
-
Reporter name:
Original Reporter info from Mantis: lagprogramming
- Reporter name:
Description:
The code found at the beginning of the procedure indicates that the procedure should not store negative values, but it does due to the line:
FRange := AValue;
Original procedure according to http://svn.freepascal.org/svn/lazarus/trunk/lcl/include/controlscrollbar.inc
procedure TControlScrollBar.InternalSetRange(const AValue: Integer);
var
NewRange: Integer;
begin
NewRange := AValue;
if NewRange < 0 then
NewRange := 0;
if FRange = NewRange then
Exit;
FRange := AValue;
{$IFDEF VerboseScrollingWinControl}
//if DebugCondition then
DebugLn(['TControlScrollBar.SetRange ',dbgs(Kind),' ',Self,' FRange=',FRange]);
{$ENDIF}
ControlUpdateScrollBars;
end;
Additional information:
The following code should be better:
procedure TControlScrollBar.InternalSetRange(const AValue: Integer);
var NewRange: Integer;
begin
NewRange := AValue;
if NewRange < 0 then NewRange := 0;
if FRange <> NewRange then
begin
FRange := NewRange;
{$IFDEF VerboseScrollingWinControl}
//if DebugCondition then
DebugLn(['TControlScrollBar.SetRange ',dbgs(Kind),' ',Self,' FRange=',FRange]);
{$ENDIF}
ControlUpdateScrollBars;
end;
end;
Mantis conversion info:
- Mantis ID: 25693
- Version: 1.0.15 (SVN)
- Fixed in revision: 43951 (#92eb98b5)