2020-11-03 04:58 PM
I add a two hardware button to control the up and down scrolling of scrollableContainer(use function "moveChildrenRelative"). But the function "getScrolledY()" can't update according to the scroll action. And I need the ScrolledY to respond to some events.
What should I do to deal with it?
Solved! Go to Solution.
2020-11-04 12:46 AM
Hello,
You are right. This is probably something we should change in the near future. I'll tell the team about it.
For the time being, I believe you can simply modify the function manually like as follows :
void ScrollableContainer::moveChildrenRelative(int16_t deltaX, int16_t deltaY)
{
Drawable* d = firstChild;
while (d)
{
if ((d != &xSlider) && (d != &ySlider))
{
if(calledFromOutsideTheClassFlag == true)
{
scrolledXDistance += deltaX;
scrolledYDistance += deltaY;
}
d->moveRelative(deltaX, deltaY);
}
d = d->getNextSibling();
}
}
If you want this changes to be taken into account on your board, you need to copy this class in your gui/ folder and use this customClass instead. Unfortunately this will make you unable to use the Designer since it becomes a class the Designer does not know about.
When your question is answered, please close this topic by choosing Select as Best.
/Alexandre
2020-11-04 12:46 AM
Hello,
You are right. This is probably something we should change in the near future. I'll tell the team about it.
For the time being, I believe you can simply modify the function manually like as follows :
void ScrollableContainer::moveChildrenRelative(int16_t deltaX, int16_t deltaY)
{
Drawable* d = firstChild;
while (d)
{
if ((d != &xSlider) && (d != &ySlider))
{
if(calledFromOutsideTheClassFlag == true)
{
scrolledXDistance += deltaX;
scrolledYDistance += deltaY;
}
d->moveRelative(deltaX, deltaY);
}
d = d->getNextSibling();
}
}
If you want this changes to be taken into account on your board, you need to copy this class in your gui/ folder and use this customClass instead. Unfortunately this will make you unable to use the Designer since it becomes a class the Designer does not know about.
When your question is answered, please close this topic by choosing Select as Best.
/Alexandre
2020-11-04 04:18 PM
OK, I got it. And I apply another way to deal with it.
I define a serise of click, drag, gestrue event to realize the similar effect. And it can bypass this problem.:beaming_face_with_smiling_eyes:
By the way I want to know a standard action from the professionals.