P Pantelis Member Licensed User Longtime User May 27, 2013 #1 Hi I am trying to set the Scrollposition property of one HorizontalScrollView with the code:: LongLayout.ScrollPosition = 700 If i put the code in a sub event of a button like button1_click it works ok. But if i put the same code just before the end of "Sub Activity_Create" nothing happens. The ScrollView remains in its original scroll position. Setting another property like "LongLayout.Height = 300" work ok on "Sub Activity_Create" Why this happens? Thanks
Hi I am trying to set the Scrollposition property of one HorizontalScrollView with the code:: LongLayout.ScrollPosition = 700 If i put the code in a sub event of a button like button1_click it works ok. But if i put the same code just before the end of "Sub Activity_Create" nothing happens. The ScrollView remains in its original scroll position. Setting another property like "LongLayout.Height = 300" work ok on "Sub Activity_Create" Why this happens? Thanks
Erel B4X founder Staff member Licensed User Longtime User May 28, 2013 #2 This happens because the HorizontalScrollView smoothly scrolls to the position. You should change your code to: Code: Copy LongLayout.ScrollPosition = 700 DoEvents LongLayout.ScrollPosition = 700 DoEvents Note that this code is also wrong. You should use 700dip. Upvote 0
This happens because the HorizontalScrollView smoothly scrolls to the position. You should change your code to: Code: Copy LongLayout.ScrollPosition = 700 DoEvents LongLayout.ScrollPosition = 700 DoEvents Note that this code is also wrong. You should use 700dip.
P Pantelis Member Licensed User Longtime User May 28, 2013 #3 Thank you Erel. The code must be writen twice as in your example? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User May 30, 2013 #4 If I remember correctly it needs to be set twice. Upvote 0
GGSoft Member Licensed User Longtime User Jun 27, 2017 #5 Erel said: This happens because the HorizontalScrollView smoothly scrolls to the position. You should change your code to: Code: Copy LongLayout.ScrollPosition = 700 DoEvents LongLayout.ScrollPosition = 700 DoEvents Click to expand... So far I have used this "technique". Is it still valid? Upvote 0
Erel said: This happens because the HorizontalScrollView smoothly scrolls to the position. You should change your code to: Code: Copy LongLayout.ScrollPosition = 700 DoEvents LongLayout.ScrollPosition = 700 DoEvents Click to expand... So far I have used this "technique". Is it still valid?
klaus Expert Licensed User Longtime User Jun 27, 2017 #6 Is it still valid? Click to expand... Yes for B4A til version 6.80 Since version 7.00, try to use use this: Code: Copy Sleep(0) LongLayout.ScrollPosition = 700dip At least it works with the ScrollView. Upvote 0
Is it still valid? Click to expand... Yes for B4A til version 6.80 Since version 7.00, try to use use this: Code: Copy Sleep(0) LongLayout.ScrollPosition = 700dip At least it works with the ScrollView.