MUI: adjusted Scrollbar behavior

git-svn-id: trunk@53975 -
This commit is contained in:
marcus 2017-01-19 20:52:16 +00:00
parent bdd5fb55ac
commit 53c292bb51
3 changed files with 19 additions and 15 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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])