When you install a C callback, you can pass some void* member data (usually):
The trick is to retrieve that pointer in your callback, cast to your object and then call the method you want to invoke on that object.
// Code where callback is registered
void MyObject::setup()
{
// Register C callback
addCallback(&my_callback_function, this /* member data */);
}
static void my_callback_function(void* data, char* text)
{
MyObject* ob = static_cast<MyObject*>(data);
// Call the methodfor your object her now
ob->Write_To_Display(text);
}
// Code where callback is registered
void MyObject::setup()
{
// Register C callback
addCallback(&my_callback_function, this /* member data */);
}
static void my_callback_function(void* data, char* text)
{
MyObject* ob = static_cast<MyObject*>(data);
// Call the methodfor your object her now
ob->Write_To_Display(text);
}
To copy to clipboard, switch view to plain text mode
Hope that makes sense
Bookmarks