* * *

Author Topic: TControlScrollBar.Page has bad behavior  (Read 495 times)

jamie

  • Hero Member
  • *****
  • Posts: 785
TControlScrollBar.Page has bad behavior
« on: May 26, 2018, 04:18:42 am »
In code I have, I set the VertScrollBar.Page := ClientHeight to adjust the scroll button in the
onSize event..

  There is range checking code compiled into the LCL for this to fault if it gets out of the range of 1..32767.

  Users can and I have also, shrink the client area all the way to 0 height, this generates a Fault of course..

  So extra code in the user's program needs to be put in there everywhere you go to make sure you don't pass
a < 1 value which to me is wasting code space and CPU time..

 If CleintHeight > 0 Then VertScrollbar.Page := ClientHeight;

 Shouldn't the PAGE property simply default to 1  for values less than 1 or default to 32767 for values over that and
save us all from needing to write extra code at every turn?




jamie

  • Hero Member
  • *****
  • Posts: 785
Re: TControlScrollBar.Page has bad behavior
« Reply #1 on: May 27, 2018, 06:09:50 pm »
seeing where there is no response to this issue that I find is a bloater for code, I wonder if I should suggest a change
and report it to the bug page?

 basically the scrollbar.Page should default to a min size or simply ignore it but not fault your program with a
range error that is not even in your code.

Not all faults should trigger a collapse of your code, but simply adjust itself and exit or at least report back a
Boolean operation of success or failure, but then that would mean needing a Method function to be exposed.




 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus