Scrollbars always visible in scrolling controls
Original Reporter info from Mantis: Dr.Theopolis
-
Reporter name:
Original Reporter info from Mantis: Dr.Theopolis
- Reporter name:
Description:
The vertical and horizontal scrollbars are always visible in forms when AutoScroll is set, and also in scroll boxes at all times.
Steps to reproduce:
Start a new project, set form AutoScroll to true. Run it, and with an empty form the scrollbars are visible.
For scrollboxes, put an empty scrollbox on a form. Run it, and the scrollbox scrollbars are visible.
Additional information:
I have tested this on the following:
Lazarus 1.2.6, fpc 2.6.4, OS X 10.7.5 - has the problem
Lazarus SVN rev 47650 , OS X 10.7.5 and 10.5.5 - has the problem
Lazarus 1.0.10 - does not have the problem
In the unit scrollingwincontrol.inc, the procedure TScrollingWinControl.ComputeScrollbars went through some changes at some point. I have been looking into this issue extensively but I am having a hard time finding out exactly what the problem is. It seems to have something to do with client sizes with/without scrollbar. I can't say that there is anything wrong with the way ComputeScrollbars is coded, but through experimenting I find the following to fix the problem for OS X for forms and scrollboxes. The procedure is common to all widgetsets so the following may not be the appropriate fix.
procedure TScrollingWinControl.ComputeScrollbars;
procedure UpdateBar(aBar: TControlScrollBar; aClientSize: integer);
begin
aBar.FPage := Min(aClientSize, Max(1,Min(aClientSize, High(HorzScrollbar.FPage))));
aBar.FAutoRange := Max(0, aBar.Range - aClientSize);
end;
var
ClientW: Integer;
ClientH: Integer;
begin
CalculateAutoRanges;
ClientW := VertScrollBar.ClientSize;
ClientH := HorzScrollBar.ClientSize;
UpdateBar(HorzScrollBar,ClientW);
UpdateBar(VertScrollBar,ClientH);
end;
Mantis conversion info:
- Mantis ID: 27449
- OS: OS X
- OS Build: 10.7.5
- Platform: Mac
- Version: 1.2.6
- Monitored by: » ps (Pavol S)