2018-11-27 01:47 AM
QUESTION - TouchGFX Community repost - Tomasz Lasota - Sep 2017
Hello
How to scroll programatically to a cretain entry in the list?
ScrollableContainer::doScroll() - is protected
Tomasz
ANSWER - TouchGFX Community repost - Martin Kjeldsen - Sep 2017
You could create a MyScrollableContainer as a subclass of ScrollableContainer. Then you can make a public function myScroll() which calls the protected ScrollableContainer::doScroll() function.
ANSWER - TouchGFX Community repost - Tomasz Lasota - Sep 2017
I did
#include <touchgfx/containers/ScrollableContainer.hpp>
using namespace touchgfx;
class MyScrollableContainerA :
public ScrollableContainer
{
public:
MyScrollableContainerA();
~MyScrollableContainerA();
bool doScroll(int16_t deltaX, int16_t deltaY);
};
#include "MyScrollableContainerA.h"
MyScrollableContainerA::MyScrollableContainerA()
{
}
MyScrollableContainerA::~MyScrollableContainerA()
{
}
bool MyScrollableContainerA::doScroll(int16_t deltaX, int16_t deltaY)
{
return doScroll(deltaX, deltaY);
}
call function
scrollableMenu.doScroll(0, 0);
or
scrollableMenu.doScroll(0, 1);
and I have in doScroll
Unhandled exception at 0x00CA5169 in Application.exe: 0xC0000005: Access violation writing location 0x00860F34.
--
I was wrong
bool MyScrollableContainerA::doScroll(int16_t deltaX, int16_t deltaY)
{
return ScrollableContainer::doScroll(deltaX, deltaY);
}
thank you
works correctly