Recent

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

jamie

  • Hero Member
  • *****
  • Posts: 1785
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: 1785
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.




pixelink

  • Hero Member
  • *****
  • Posts: 1031
    • Pixelink Media
Re: TControlScrollBar.Page has bad behavior
« Reply #2 on: May 17, 2019, 11:07:50 pm »
I am trying to put together a scrollbar sample project myself, and I frankly don't completely understand how the page works, so I am lost as far as that goes.

I understand how a scrollbar should work, but how to code it is a challenge for me right now because the SB goes from 0 to 100 (whatever value)... it goes up.

But if i move an object on a form, using the VERT SB, and then go down with the SB, my object moves down too because control.top is visible and has positive numbers in the visible.

But I want my controls to go up... into negative numbers.... out of sight
Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media •  My LAZ Software
LAZ 2.02 • Win10 • 16G RAM • Nivida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1031
    • Pixelink Media
Re: TControlScrollBar.Page has bad behavior
« Reply #3 on: May 17, 2019, 11:58:29 pm »
I did figure out what page was, its just the size of the thumb bar, I thought it did something significant.

Can't Type - Forgetful - Had Stroke = Forgive this old man!

Pixelink Media •  My LAZ Software
LAZ 2.02 • Win10 • 16G RAM • Nivida GForce RTX 2060