2020-02-27 10:35 PM
hello...
I have a swipe container which consist of three pages ..what i have done is i want a scroll wheel in page 2 as screen, so i covered whole screen (page 2) with scroll wheel
but when am doing swipe i can't able to swipe from page 2 to page 3..may i haves scroll wheel entire may be it is not working..is there any solution for this issue...if any please let me know..
thank you..
Solved! Go to Solution.
2020-03-05 07:10 AM
If your scroll wheel filling the entire screen is horizontal then it is not possible to distinguish the swipe container and the scroll wheel. However, if the scroll wheel is vertical, then you need to distinguish between horizontal drag and vertical drag as well as clicks on the scroll wheel or outside the scroll wheel.
Here is a example that shows the way I performed this distinction for a project related to a music player with a scroll list (similar behavior as the scroll wheel) and a swipe container.
void MusicPlayerView::handleClickEvent(const ClickEvent& evt)
{
if (evt.getType() == ClickEvent::PRESSED)
{
if(scrollablePlaylistContainer.getAbsoluteRect().intersect(evt.getX(), evt.getY()))
{
isPlaylistClicked = true;
}
}
else if (evt.getType() == ClickEvent::RELEASED)
{
dragType = NONE;
}
if(dragType != VERTICAL) //The swipe container should handle the event
{
musicPlayerSwipeContainer.handleClickEvent(evt);
}
MusicPlayerViewBase::handleClickEvent(evt);
}
void MusicPlayerView::handleDragEvent(const DragEvent& evt)
{
if(isPlaylistClicked)
{
isPlaylistClicked = false;
if(abs(evt.getDeltaY()) < abs(evt.getDeltaX()))
{
dragType = HORIZONTAL;
}
else
{
dragType = VERTICAL;
}
}
else
{
if(dragType == HORIZONTAL) //The swipe container should handle the event
{
musicPlayerSwipeContainer.handleDragEvent(evt);
}
else //The scroll container or the view should handle the event
{
MusicPlayerViewBase::handleDragEvent(evt);
}
}
}
void MusicPlayerView::handleGestureEvent(const GestureEvent& evt)
{
if(dragType == HORIZONTAL) //The swipe container should handle the event
{
musicPlayerSwipeContainer.handleGestureEvent(evt);
}
else //The scroll container or the view should handle the event
{
MusicPlayerViewBase::handleGestureEvent(evt);
}
}
/Alexandre
2020-03-05 07:10 AM
If your scroll wheel filling the entire screen is horizontal then it is not possible to distinguish the swipe container and the scroll wheel. However, if the scroll wheel is vertical, then you need to distinguish between horizontal drag and vertical drag as well as clicks on the scroll wheel or outside the scroll wheel.
Here is a example that shows the way I performed this distinction for a project related to a music player with a scroll list (similar behavior as the scroll wheel) and a swipe container.
void MusicPlayerView::handleClickEvent(const ClickEvent& evt)
{
if (evt.getType() == ClickEvent::PRESSED)
{
if(scrollablePlaylistContainer.getAbsoluteRect().intersect(evt.getX(), evt.getY()))
{
isPlaylistClicked = true;
}
}
else if (evt.getType() == ClickEvent::RELEASED)
{
dragType = NONE;
}
if(dragType != VERTICAL) //The swipe container should handle the event
{
musicPlayerSwipeContainer.handleClickEvent(evt);
}
MusicPlayerViewBase::handleClickEvent(evt);
}
void MusicPlayerView::handleDragEvent(const DragEvent& evt)
{
if(isPlaylistClicked)
{
isPlaylistClicked = false;
if(abs(evt.getDeltaY()) < abs(evt.getDeltaX()))
{
dragType = HORIZONTAL;
}
else
{
dragType = VERTICAL;
}
}
else
{
if(dragType == HORIZONTAL) //The swipe container should handle the event
{
musicPlayerSwipeContainer.handleDragEvent(evt);
}
else //The scroll container or the view should handle the event
{
MusicPlayerViewBase::handleDragEvent(evt);
}
}
}
void MusicPlayerView::handleGestureEvent(const GestureEvent& evt)
{
if(dragType == HORIZONTAL) //The swipe container should handle the event
{
musicPlayerSwipeContainer.handleGestureEvent(evt);
}
else //The scroll container or the view should handle the event
{
MusicPlayerViewBase::handleGestureEvent(evt);
}
}
/Alexandre
2020-03-08 10:52 PM
THANK YOU...
Can you please provide the .h file also.... whatever you have provided to me is .c file and i can't able to understand what is musicPlayerSwipeContainer...and what is scrollablePlaylistContainer this i
is i think your widget names in the designer please give me proper details on this....
thank you
2020-03-09 03:33 AM
As the names state, musicPlayerSwipeContainer is a SwipeContainer and scrollablePlaylistContainer is a ScrollableContainer.
touchgfx::SwipeContainer musicPlayerSwipeContainer;
touchgfx::ScrollableContainer scrollablePlaylistContainer;
Giving you the hpp files would not help you as there is a lot of other things coded and it would be irrelevant. I gave you all you need to implement your own swipe container and scrollWheel or ScrollableContainer to be able to make your own application.
/Alexandre
2023-01-23 05:45 AM
I can confirm this is working perfectly with 0 changes