I want to write a menu library for TFT touch screens. I need to have callback functions for when a MenuItem is selected. I wrote the following constructor:
Header:
MenuItem(void (*cbFunction)(MenuItem *));
Implementation:
MenuItem::MenuItem(void (*cbFunction(MenuItem *)))
{
// Code...
}
I get the following error:
MenuItem.cpp:13: error: prototype for 'MenuItem::MenuItem(void* ()(MenuItem))' does not match any in class 'MenuItem'
MenuItem.h:7: error: candidates are: MenuItem::MenuItem(const MenuItem&)
MenuItem.h:13: error: MenuItem::MenuItem(String, void ()(MenuItem), MenuItem::inputMode)
MenuItem.h:12: error: MenuItem::MenuItem(void ()(MenuItem))
MenuItem.cpp:8: error: MenuItem::MenuItem(String)
MenuItem.cpp:3: error: MenuItem::MenuItem()
Why is there a * after the void (return type of the callback function) in the first line of the error message? Can someone help me and explain why this isn't working and how i could correct it?
Thanks in advance,
dusti