Firemonkey ScrollBox Bug

主宰稳场 提交于 2019-12-04 23:37:25

After having all sorts of problems with scrolling, I have come to the conclusion that there is an initialisation problem with scrolling components in firemonkey, which manifest in dodgy scrolling behaviour. Sometimes it will work and sometimes it will not...

After having thought that I fixed the problem several times, only to watch the problem reappear on a subsequent compile (or a different OS), I have had much success in calling the component's UpdateStyle method after adding all of the child components. I.e. the problem has not resurfaced since adding the call...

E.g. The following pseudo code populates a scroll component then calls UpdateStyle which seems to force the component to 'fix' invalid settings for various properties - Min, Max etc.

for i := 1 to x do
  MyScrollComponent.AddObject(MyObject[i]);
MyScrollComponent.UpdateStyle;

Hope this works for you too...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!