cancel
Showing results for 
Search instead for 
Did you mean: 

Why is TouchGFX Swipe Threshold inconsistent?

wired
Senior III

I'm using the STM32F469I-DISCO board with TouchGFX. In portrait mode, I set the swipe threshold to 400 because I want the user to swipe almost all the way across the screen to switch pages. When I swipe slowly, it seems to work. However, a fast swipe changes pages with a swipe distance of only 1/2" or so. Is there a way to not make this speed-dependent? Right now, it is very easy to accidentally change pages. I want the page change to be very intentional.

1 ACCEPTED SOLUTION

Accepted Solutions
wired
Senior III

So I filed a support request from ST, and they told me that the fast swipe feature is the default implementation. If you wish to make the swipeThreshold behave as it is documented in the API documentation, you must override the gesture handler in the screen that has the Swipe Container. See below for the added declaration. This is all that needs to be done - no function needs to be written. I suggested that they provide additional detail in the API for the swipeThreshold member so that people know it is only applicable for a slow swipe, and provide instructions an how to disable the fast swipe feature as shown below.

class Screen1View : public Screen1ViewBase
{
public:
    Screen1View();
    virtual ~Screen1View() {}
    virtual void setupScreen();
    virtual void tearDownScreen();
	
    virtual void handleGestureEvent(const GestureEvent& event) {}
    //event from Presenter
protected:
};

View solution in original post

4 REPLIES 4
wired
Senior III

Is there nobody at ST who can explain this? What good is a threshold if it will not produce the desired result?

wired
Senior III

This is critical to my application, as I am unintentionally activating a swipe on many occasions on a 480 pixel wide display, using a swipe threshold of 400 pixels, just by trying to press a button. This occurs both in the simulator and in the target. Why is this happening??? I tried setting the threshold to 1200, almost three times wider than the display, and set the elastic width to zero, and those changes made no difference whatsoever. It's bad enough that just a minor brush of a tiny portion of the screen causes a swipe, but when I'm trying to press a button? Surely someone at ST is monitoring this and can provide an explanation. I need to know if I need to abandon swipe containers in my application, which has serious design implications.

wired
Senior III

So I filed a support request from ST, and they told me that the fast swipe feature is the default implementation. If you wish to make the swipeThreshold behave as it is documented in the API documentation, you must override the gesture handler in the screen that has the Swipe Container. See below for the added declaration. This is all that needs to be done - no function needs to be written. I suggested that they provide additional detail in the API for the swipeThreshold member so that people know it is only applicable for a slow swipe, and provide instructions an how to disable the fast swipe feature as shown below.

class Screen1View : public Screen1ViewBase
{
public:
    Screen1View();
    virtual ~Screen1View() {}
    virtual void setupScreen();
    virtual void tearDownScreen();
	
    virtual void handleGestureEvent(const GestureEvent& event) {}
    //event from Presenter
protected:
};

Strange and unintuitive... Glad it worked out.