diff --git a/lcl/interfaces/mui/muistdctrls.pas b/lcl/interfaces/mui/muistdctrls.pas index 0b395dcb8e..a29949e8fb 100644 --- a/lcl/interfaces/mui/muistdctrls.pas +++ b/lcl/interfaces/mui/muistdctrls.pas @@ -305,7 +305,7 @@ end; function TMUIScrollBar.GetPosition: Integer; begin Result := GetAttribute(MUIA_Prop_First) + FMinValue; - //DebugLn('LCL: GetPosition: ' + IntToStr(Result) + ' MinValue: ' + IntToStr(FMinValue)); + //SysDebugLn('LCL: GetPosition: ' + IntToStr(Result) + ' MinValue: ' + IntToStr(FMinValue)); end; procedure TMUIScrollBar.SetHoriz(AValue: Boolean); @@ -317,12 +317,13 @@ procedure TMUIScrollBar.SetMaxValue(AValue: Integer); var Pos: Integer; begin - //debugln('set MaxValue ' + IntToStr(AValue)); + //sysdebugln('set MaxValue ' + IntToStr(AValue)); if (AValue = FMaxValue) or (AValue <= FMinValue) then Exit; Pos := Position; FMaxValue := AValue; - SetAttribute(MUIA_Prop_Entries, (AValue - FMinValue) + FPageSize); + SetAttribute(MUIA_Prop_Entries, FMaxValue - FMinValue); + SetAttribute(MUIA_Prop_Visible, FPageSize); Position := Pos; end; @@ -332,10 +333,11 @@ var begin if AValue = FMinValue then Exit; - //debugln('set MinValue ' + IntToStr(AValue)); + //sysdebugln('set MinValue ' + IntToStr(AValue)); Pos := Position; FMinValue := AValue; - SetAttribute(MUIA_Prop_Entries, (FMaxValue - AValue) + FPageSize); + SetAttribute(MUIA_Prop_Entries, FMaxValue - FMinValue); + SetAttribute(MUIA_Prop_Visible, FPageSize); Position := Pos; end; @@ -345,17 +347,17 @@ var begin if AValue = FPageSize then Exit; - //debugln('set page size ' + IntToStr(AValue)); + //sysdebugln('set page size ' + IntToStr(AValue)); Pos := Position; FPageSize := AValue; - SetAttribute(MUIA_Prop_Entries, (FMaxValue - FMinValue) + AValue); - SetAttribute(MUIA_Prop_Visible, AValue); + SetAttribute(MUIA_Prop_Entries, FMaxValue - FMinValue); + SetAttribute(MUIA_Prop_Visible, FPageSize); Position := Pos; end; procedure TMUIScrollBar.SetPosition(AValue: Integer); begin - //DebugLn('LCL: set to '+ IntToStr(AValue) + ' Position is ' + IntToStr(Position) + ' MinValue: ' + IntToStr(FMinValue)); + //sysDebugLn('LCL: set to '+ IntToStr(AValue) + ' Position is ' + IntToStr(Position) + ' MinValue: ' + IntToStr(FMinValue)+ ' MaxValue: ' + IntToStr(FMaxValue)); if AValue <> Position then begin SetAttribute(MUIA_Prop_First, AValue - FMinValue); diff --git a/lcl/interfaces/mui/muiwinapi.inc b/lcl/interfaces/mui/muiwinapi.inc index 3fb48e021c..646992590c 100644 --- a/lcl/interfaces/mui/muiwinapi.inc +++ b/lcl/interfaces/mui/muiwinapi.inc @@ -894,7 +894,7 @@ begin if not Assigned(SC) then Exit; ScrollInfo.nMin := SC.MinValue; - ScrollInfo.nMax := SC.MaxValue + SC.PageSize; + ScrollInfo.nMax := SC.MaxValue; ScrollInfo.nPage := SC.PageSize; ScrollInfo.nPos := SC.Position; Result := True; @@ -1574,8 +1574,8 @@ begin begin if SC.MinValue <> ScrollInfo.nMin then SC.MinValue := ScrollInfo.nMin; - if SC.MaxValue <> (ScrollInfo.nMax) - ScrollInfo.nPage then - SC.MaxValue := (ScrollInfo.nMax) - ScrollInfo.nPage; + if SC.MaxValue <> ScrollInfo.nMax then + SC.MaxValue := ScrollInfo.nMax; end; if ((SIF_POS and ScrollInfo.fMask) <> 0) and (SC.Position <> ScrollInfo.nPos) then SC.Position := ScrollInfo.nPos; diff --git a/lcl/interfaces/mui/muiwsstdctrls.pp b/lcl/interfaces/mui/muiwsstdctrls.pp index 187442032c..7c23bb4698 100644 --- a/lcl/interfaces/mui/muiwsstdctrls.pp +++ b/lcl/interfaces/mui/muiwsstdctrls.pp @@ -273,11 +273,13 @@ class function TMUIWSScrollBar.CreateHandle(const AWinControl: TWinControl; cons var MUIScrollbar: TMUIScrollbar; TagList: TATagList; + AScrollBar: TCustomScrollBar; begin + AScrollBar := TCustomScrollBar(AWinControl); TagList.AddTags([ - MUIA_Prop_First, 0, - MUIA_Prop_Entries, 120, - MUIA_Prop_Visible, 20 + MUIA_Prop_First, AScrollBar.Position, + MUIA_Prop_Entries, AScrollBar.Max - AScrollBar.Min, + MUIA_Prop_Visible, AScrollBar.PageSize ]); if TScrollbar(AWinControl).Kind = sbHorizontal then TagList.AddTags([MUIA_Group_Horiz, TagTrue])