Hey guys,
I created 100 buttons, going down the screen, and then implemented a ScrollView. It works, but only if I am not touching the buttons. So I can scroll down or up if my finger is not on the buttons, this is a problem because the buttons take up the whole screen and I don’t want to change that. Any suggestions as to how I can make it so the ScrollView works wherever I touch the screen, no matter whats there?
Thanks in Advance
Hi @RGgamer,
Well, both the ScrollView and the buttons technically need to accept user input, so you need to use the “takeFocus()” API and detect when the user is trying to press a button vs. trying to move the ScrollView.
There’s a code example of this in our documentation (it’s a fairly common need, so we show how to implement it properly):
https://docs.coronalabs.com/api/type/ScrollViewWidget/takeFocus.html
Take care,
Brent
Thanks so much, it works perfectly.
Hi @RGgamer,
Well, both the ScrollView and the buttons technically need to accept user input, so you need to use the “takeFocus()” API and detect when the user is trying to press a button vs. trying to move the ScrollView.
There’s a code example of this in our documentation (it’s a fairly common need, so we show how to implement it properly):
https://docs.coronalabs.com/api/type/ScrollViewWidget/takeFocus.html
Take care,
Brent
Thanks so much, it works perfectly.