ScrollView

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Is there any explanation about ScrollView event "ScrollChanged" and its parameter "Position"? I just verified that, at any scroll, it increases/decreases its value by the row height, but, for example, the value assumed at first scroll down is not clear. If I first scroll down one line, it gives an initial value, say 32, while scrolling up gives another, say 48. Row height is 50, internal Panel is 280 height. Unluckily I don't see the relation among these values..
 

klaus

Expert
Licensed User
Longtime User
ScrollView position is the coordinate of the visible upper edge of the internal panel. It's equivalent to -Panel.Top. The scrolling is independant of the content of the ScrollView.Panel no relationship with the height of the views inside the ScrollView.Panel.

Best regards.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Thanks for quick answer, but I still don't understand. My ScrollView displays 5 rows of 50 pixel height. MyScrollView height is 280. If I debug and put a breakpoint in ScrollChanged event, I get Position=32 at first scroll down. You say that it should be the -MyScrollView.Panel.Top value. By the way, in the debugger, if I put
Dim a as integer
a=MyScrollView.Panel.Top
I get an error.
Forgetting the error (though I also don't understand why, because intellisense gives the possibility to make that assign), if I scroll up, I get 48.
First scroll value (downwards) seems 2 pixel more the difference between total height of MyScrollView and the sum of the displayed rows height, while second value (upwards) seems the height of the row less 2.
If I do a second scroll downwards I get 82, which is the initial value plus 50, and what happens is clear. Now, can I assume that initial value (32) is MyScrollView.Height-NumberOfRows*HeighOfRow +2 (i.e. 280-250+2)?
My need is to scroll the view, then "change the page", (loading another layout), then return to previous page at same position in the scroll view. It seems to me that such a situation needs some coding, because when I go back to initial scrollview, I must reconstruct it (because it is a part of a layout) and redisplay it. Then I was thinking to force some scrolling to reach same position as before. If you have some "ready" better hint, I can appreciate. Thanks anyway.
 
Upvote 0
Top