cancel
Showing results for 
Search instead for 
Did you mean: 

TouchGFX slider callback issue

MPozo.1
Associate

Hello Coders!

I have problem with slider callback - error: no match for call to '(touchgfx::Callback<Screen3View, const touchgfx::Slider&, int>) (Screen3View*, void (Screen3View::*)(const touchgfx::Slider&, int))' . Followed the guide

here on touchgfx side implementing slider, and seems callback slider routine is generating error.

here's the code

HPP FILE Screen3View.hpp
class Screen3View : public Screen3ViewBase
{
public:
    Screen3View();
    virtual ~Screen3View() {}
    virtual void setupScreen();
    virtual void tearDownScreen();
protected:
 
    	touchgfx::Callback<Screen3View, const touchgfx::Slider&, int> sliderValueStartedChangeCallback;
        touchgfx::Callback<Screen3View, const touchgfx::Slider&, int> sliderValueChangedCallback;
        touchgfx::Callback<Screen3View, const touchgfx::Slider&, int> sliderValueConfirmedCallback;
 
        /*
         * Callback Handler Declarations
         */
        void sliderValueStartedChangeCallbackHandler(const touchgfx::Slider& src, int value);
        void sliderValueChangedCallbackHandler(const touchgfx::Slider& src, int value);
        void sliderValueConfirmedCallbackHandler(const touchgfx::Slider& src, int value);
};

and in Screen3View.cpp reciving error at line 4:

error: no match for call to '(touchgfx::Callback<Screen3View, const touchgfx::Slider&, int>) (Screen3View*, void (Screen3View::*)(const touchgfx::Slider&, int))'

  8 | 

cpp file
Screen3View::Screen3View()
{
 
	sliderValueStartedChangeCallback(this,&Screen3View::sliderValueStartedChangeCallbackHandler);
//	sliderValueChangedCallback(this, &Screen3View::sliderValueChangedCallbackHandler);
//	sliderValueConfirmedCallback(this, &Screen3View::sliderValueConfirmedCallbackHandler);
}

Can you help/guide me where is the problem?

2 REPLIES 2
Yoann KLEIN
ST Employee

Hello @MP.5ozoga​ ,

Could you please share your project ?

So we can debug it more easily.

Thank you,

/Yoann

Yoann KLEIN
ST Software Developer | TouchGFX
wired
Senior III

Try changing your CPP file to:

Screen3View::Screen3View() :
sliderValueStartedChangeCallback(this,&Screen3View::sliderValueStartedChangeCallbackHandler),
sliderValueChangedCallback(this, &Screen3View::sliderValueChangedCallbackHandler),
sliderValueConfirmedCallback(this, &Screen3View::sliderValueConfirmedCallbackHandler)
{
}

I get same errors when I change my code to look like yours.