Scroll list how to handle click and drag for better experience?
I'm currently using a scroll list on one of my view, and for the item, there is a button to transition the user to another screen. But that button is messing up the smoothness of the drag-scroll, so I followed this thread
https://community.st.com/s/question/0D50X0000AIcwHv/scroll-list-with-clickable-items
and got it differentiate between a click and drag by overriding the click and drag events.
void Screen2View::handleClickEvent(const ClickEvent& evt)
{
if (isClicked && evt.getType() == ClickEvent::RELEASED)
{
touchgfx_printf("Click detected\n");
scrollWheelListItems.element->setTouchable(true); // not working
scrollWheel.handleClickEvent(evt); // not working either
Screen2ViewBase::handleClickEvent(evt); // nore this
isClicked = false;
}
else
isClicked = true;
}
void Screen2View::handleDragEvent(const DragEvent& evt)
{
//touchgfx_printf("dragged detected ");
scrollWheel.handleDragEvent(evt);
isClicked = false;
}Now, the problem I'm facing is that because I override the click event, the button doesn't work anymore. How can I send the click event to the item's button so that it can do what is needed?
Edit: I want to say that those statements inside the if does get hit (triggers my breakpoint)