Home » Community » Newbie corner » How to use callbacks
Re: How to use callbacks [message #45867 is a reply to message #45865] |
Fri, 15 January 2016 20:12   |
Oblivion
Messages: 1204 Registered: August 2007
|
Senior Contributor |
|
|
In order to use THISBACK macro(s), which actually expands to callback(this, &CLASSNAME::foo) and other variants, where foo should be a method (memeber) of the CLASS pointed with "this" pointer, you simply need to add the following line to your class' declaration.
typedef Saisie CLASSNAME;
Now, of course you can also use a (1) non-member function as a callback or a (2) public method of another object, without defining a CLASSNAME (type).
E.g.,
1) callback(&foo)
2) callback(&cpp_object, &other_cpp_object::foo)
See U++ documents and reference examples (there is a "Callback" named example code in reference examples.)
Regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Fri, 15 January 2016 20:38] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Mon May 05 13:24:33 CEST 2025
Total time taken to generate the page: 0.03064 seconds
|