Skip to main content
MPozo.1
Visitor II
July 31, 2022
Question

TouchGFX slider callback issue

  • July 31, 2022
  • 2 replies
  • 959 views

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?

This topic has been closed for replies.

2 replies

Yoann KLEIN
ST Employee
September 12, 2022

Hello @MP.5ozoga​ ,

Could you please share your project ?

So we can debug it more easily.

Thank you,

/Yoann

Yoann KLEINST Software Developer | TouchGFX
wired
Senior II
September 13, 2022

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.